A high level library for building Discord bots.

Overview

Qord

A high level library for building Discord bots.

๐Ÿšง This library is currently in development.

Questions that you are having

  • What is this?

    This is yet another library for Discord Bots API. This is not a finished project and is currently in it's development phase.

  • Why create another library?

    After discord.py archive, I could not find a library that I could use to develop my bots in future so here we are. As it may sound, This is definitely not a personal project, See below.

  • Is this going to be a publicly available library?

    Yes, It will be a public library but currently it is not finished and not in state of being released publicly. You can still install a very unstable version of this library (pip install qord) and hack it (Instructions in CONTRIBUTING file).

  • Can I contribute?

    That would be much appreciated! See Contributing Guidelines for more information and to get yourself familiar with the project.

  • When will this be finished?

    No idea yet; but soon โ„ข๏ธ

  • Documentation?

    Yes. https://qord.readthedocs.io

  • I have more questions

    Join our Discord server: https://discord.gg/sRmvezKwD4

Comments
  • Implement ratelimits handling

    Implement ratelimits handling

    This pull request adds support for handling and prevention of ratelimits.

    • [x] Delaying requests on hitting 429s
    • [x] Global ratelimit handling
    • [x] Delay requests when a ratelimit bucket is exhausted.
    • [x] Use X-Ratelimit-Bucket (ratelimit key, as referred in code) for precise handling of ratelimits between routes that share same ratelimit.
    • [x] ~~Add hooks for ratelimits.~~
    • [x] Extensive testing.
    t: feature p: high s: testing needed 
    opened by izxxr 4
  • Expose raw HTTP methods to users.

    Expose raw HTTP methods to users.

    The current problem is that in order to perform simple HTTP operations, the instance of relevant Discord model is required. When the model is obtainable from cache, there are no problems but when the model isn't available in cache, It leads to issues of making more than one API call in order to fetch the resource and perform the wanted operation on it.

    For example to edit a message that is not in cache, the current solution is:

    message = await channel.fetch_message(123) # first API call
    await message.edit(**kwargs) # second API call
    

    This has an impact on bots who don't have specific intents enabled and in larger bots, this can impact ratelimits of the bot.

    For this purpose, there should be "raw" HTTP methods that allow you to make direct API calls to specific endpoints without fetching the relevant resource first. Taking the same example as above, The raw HTTP methods would allow the message editing in a single API call:

    await client.rest.edit_message(channel_id=123, **kwargs)
    

    Preferred Solution

    The current preferred solution is to expose the existing "internal" RESTClient class to the users. However as it is right now, it takes raw payloads for JSON body and returns raw response. We would have to refactor this class to be more user friendly in order to implement this feature.

    t: feature p: low l: breaking change 
    opened by izxxr 1
  • Rework library documentation

    Rework library documentation

    This pull request reworks the library documentation to be more easy to navigate and consistent.

    Following major changes have been made so far to the documentation and more are currently in progress:

    • Restructure the API reference into multiple sections.
    • Adds a "Getting Started" page on the documentation that currently mimics the GitHub readme but would contain a detailed intro to getting started with library and Discord bots in general.
    • Adds a better and detailed explanation to various features of the library that were left improperly documented.
    • Fixes position of various functions and classes in the API reference.
    • Moves contribution guidelines to documentation for ease of maintaining

    Feedback would be appreciated.

    t: documentation p: high 
    opened by izxxr 0
  • Fix instance checking for aiohttp.ClientSession

    Fix instance checking for aiohttp.ClientSession

    https://github.com/nerdguyahmad/qord/blob/c8398b25773c0ea7b2ea1a1696079dad2834434b/qord/core/rest.py#L55-L56

    If you check the above piece of code, you can clearly see that it raises a TypeError error if the session is an instance of aiohttp.ClientSession

    Suggested change:

    Change line 55 to this:

        if session and not isinstance(session, aiohttp.ClientSession):
    
    t: bug p: high 
    opened by UnrealFar 0
  • Message data gets overwritten during MESSAGE_UPDATE

    Message data gets overwritten during MESSAGE_UPDATE

    During the MESSAGE_UPDATE event, the message data gets overwritten and various values get the value of None or invalid default values. According to Discord documentation, This is because Discord often sends partial message data in MESSAGE_UPDATE event. Library should implement a way of only update the data that is sent by Discord rather than overwriting previously cached data.

    t: bug p: high 
    opened by izxxr 0
  • Provide raw event data on gateway event objects

    Provide raw event data on gateway event objects

    The library should provide raw event properties in the event object for the events sent over gateway.

    The purpose of this is to allow events to be somewhat independent of client's cache. This will be a workaround for the issue of missing the events that need certain entity to be cached, the most important example is message events that require message instance to be cached by the client.

    This feature is a breaking change in the sense that if your bot is missing some gateway intents, some events may dispatch with incomplete data. This would be case for many *_UPDATE and *_DELETE events. In an example of MESSAGE_UPDATE event:

    @client.event(GatewayEvent.MESSAGE_UPDATE)
    async def on_message_update(event):
      # event.message can be None if message is not cached but 
      # message_id is always present.
    
      if event.message is None:
        message = await event.channel.fetch_message(event.message_id)
      else:
        message = event.message
    
      ...
    

    The possibility of encountering an event with incomplete data is high for events like MESSAGE_UPDATE, MESSAGE_DELETE and other events that are dependent on an entity that is often not cached like messages. Whereas for events like GUILD_UPDATE, CHANNEL_CREATE and other events that are dependent on a "persistent" cache will almost never have incomplete data. The documentation would also be updated to properly reflect all possible edge cases related to events in simpler wording.

    This design is not yet finalized and there may be more changes.

    t: feature p: high l: breaking change s: planning needed 
    opened by izxxr 2
  • Add support for modifying cache behaviour.

    Add support for modifying cache behaviour.

    Currently, In order to modify the behaviour of cache, the only possible way is to write a custom cache handler implementation. However for users who are relying on default cache, this would be an overkill. This is why, A "cache settings" feature should be added that allows you to define specific common options for caching like message cache limit, private channels etc.

    A simple concept:

    cache_settings = qord.CacheSettings(
      message_limit=...,
      private_channel_limit=...,
    )
    client = qord.Client(cache_settings=cache_settings)
    

    These settings would be handled and checked by the library internally when caching entities and wouldn't require custom implementations to implement a logic for them.

    Options:

    These are current options in mind that would be able to be customised.

    • message_limit: Number of messages to cache at a time.
    • private_channel_limit: Number of private channels to cache at a time.
    • cache_message_users: Whether to cache user entities from message creates until the message is cached.

    Feedback on what options should be added would be appreciated.

    t: feature p: low 
    opened by izxxr 0
Releases(0.4.0)
  • 0.4.0(Apr 17, 2022)

    Additions

    • Added support for guild scheduled events.
    • Added support for stage instances.
    • Added following shortcut properties to Guild:
      • afk_channel
      • system_channel
      • widget_channel
      • rules_channel
      • public_updates_channel

    Fixes

    • Fix crash with KeyError during MESSAGE_UPDATE event.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Apr 13, 2022)

    Additions

    • Added support for custom guild emojis.
    • Added support for message reactions.
    • Added Guild.me property for retreiving bot member.
    • Added created_at property on appropriate Discord models.
    • Added BaseMessageChannel.messages method to iterate through channels history.
    • Added Guild.members method to iterate through guild members.
    • Added PrivateChannel.url, GuildChannel.url and Message.url properties
    • Added BaseMessageChannel.trigger_typing and BaseMessageChannel.typing for working with typing indicators.
    • Added Message.crosspost for crossposting messages in news channels.

    Changes

    • ChannelPermission now supports equality comparisons.
    • All models now shows useful information in repr()

    Fixes

    • Fixed Embed.video property running into infinite loop.
    • Fixed disparity between embed and embeds parameters in BaseMessageChannel.send
    • Fixed typing of Message.channel not including DM channels.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0a2(Apr 6, 2022)

    This release brings many new features such as ratelimits handling, permissions support etc. as well as many bug fixes. This would most likely be the last alpha release for v0.3 and next release would be stable v0.3.0!

    The major outlines for this release are given below:

    Additions

    • Added handling of HTTP ratelimits.
    • Added support for channel permission overwrites.
    • Added equality comparison support for various Discord models.
    • Added module qord.utils, see API reference for more info.
    • Added Message.referenced_message attribute.
    • Added qord.utils.create_timestamp helper function.
    • Added Embed.total_length and builtins.len() support on Embed
    • Added channel keyword argument in GuildMember.edit

    Improvements/Misc.

    • User.mention string no longer includes !, This is done in order to comply with the recent change done to Discord client. For more information, see this issue
    • DefaultCache.private_channels cache is now bound to limit of 256 channels.
    • File constructor no longer raises RuntimeError on failing to resolve file name and now fallbacks to untitled

    Fixes

    • Fixed cache not cleaning up on client closure.
    • Fixed typing issues across the library.
      • Passing None is not supported in various places especially x_url() methods.
      • None is now allowed in reason parameters in REST methods.
      • Various methods of cache handlers now return typing.List rather than the typing.Sequence
      • Other minor improvements and fixes.
    • Fixed GuildCache.roles returning empty list for HTTP retrieved guilds.
    • Minor bug fixes.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0a1(Mar 13, 2022)

    Breaking Changes:

    • Event system restructure

      • Custom events are now created using BaseEvent
      • Client.invoke_event() now takes single BaseEvent instance.
      • BaseEvent is no longer a protocol, all custom events must inherit it.
      • New protocol class BaseGatewayEvent has been added for gateway related events.
    • MessagesSupport was renamed to BaseMessageChannel for consistency.

    Additions:

    • Add MessageType enumeration.
    • Add support for message embeds.
    • Add support for message allowed mentions.
    • Add support for message flags.
    • Add support for message references.
    • Add Message.edit() and Message.delete() methods.
    • Add Shard.disconnect() and reconnect() methods.
    • Add PrivateChannel.close() method.
    • Add Intents.message_content privileged intent flag.
    • send() now supports embeds, files, allowed mentions and all other fields.

    Fixes:

    • Fix various crashes on startup.
    • Fix minor bugs.

    Improvements:

    • Startup time has minor improvements.
    • Library is now completely typed, there may be breaking type changes.
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Mar 5, 2022)

    What's New

    • Added support for guild roles.
    • Added support for guild members.
    • Added support for permissions.
    • Added support for guild channels.
    • Added support for messages.
    • Added User.proper_name property.
    • Added User.mention property.

    Tweaks

    • Guild.cache is no longer optional.
    • Startup time has been significantly improved.

    Bug fixes

    • Fixed GuildCache.clear() not getting called upon guild evictions.
    • Fixed extension parameter incorrectly behaving for various URL methods.
    • Fixed shards closing on receiving unhandleable OP code.
    • Fixed client not properly closing in some cases.
    • Fixed Client.launch() raising RuntimeError upon relaunching the client after closing.

    Commits since previous version: https://github.com/nerdguyahmad/qord/compare/0.2.0a1...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0a1(Feb 16, 2022)

    Changelog

    • Add support for users. (#2)
    • Add support for guilds. (#4)
    • Add support for caching. (#5)
    • Fix wrong instance check on manually passing a client session. (#3)
    • Event listeners tasks now have proper exception handling.
    • Various performance improvements.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0-alpha(Feb 8, 2022)

Owner
Izhar Ahmad
Izhar Ahmad
Drover is a command-line utility for deploying Python packages to Lambda functions.

drover drover: a command-line utility for deploying Python packages to Lambda functions. Background This utility aims to provide a simple, repeatable,

Jeffrey Wilges 4 May 19, 2021
Okaeri Robot: a modular bot running on python3 with anime theme and have a lot features

OKAERI ROBOT Okaeri Robot is a modular bot running on python3 with anime theme a

Dream Garden (rey) 2 Jan 19, 2022
A Python API For Questionnaire

ะ˜ะฝัั‚ั€ัƒะบั†ะธั ะฟะพ ั€ะฐะทะฒะพั€ะฐั‡ะธะฒะฐะฝะธัŽ ะฟั€ะธะปะพะถะตะฝะธั ะžะบั€ัƒะถะตะฝะธะต ะฟั€ะพะตะบั‚ะฐ: python 3.8 Django 2.2.10 djangorestframework ะกะบะปะพะฝะธั€ัƒะนั‚ะต ั€ะตะฟะพะทะธั‚ะพั€ะธะน ั ะฟะพะผะพั‰ัŒัŽ git: git clo

2 Feb 14, 2022
A simple Python wrapper for the archive.is capturing service

archiveis A simple Python wrapper for the archive.is capturing service. Installation pipenv install archiveis Python Usage Import it. import archi

Ben Welsh 157 Dec 28, 2022
Information about the weather in a city written using Python

Information about the weather in a city Enter the desired city Climate information of the target city This program is written using Python programming

Amir Hussein Sharifnezhad 4 Nov 17, 2021
Invites link generator for telegram(made for channel referral links)

InviteLinkGen Invites link generator for telegram(for channel referral links) made for @HelakuruEsana channel Spotify Giveaway

Jaindu Charindith 7 Feb 01, 2022
Rich presence app for playstation 3. Display what game you are playing on the PS3 via Discord

PS3-Rich-Presence-for-Discord Discord Rich Presence script for PS3 consoles on HFW&HEN or CFW. Written in Python. Display what you are playing on your

17 Dec 11, 2022
Pancakeswap Sniper Bot GUI Uniswap Matic 2022 (WINDOWS LINUX MAC) AUTO BUY TOKEN ON LAUNCH AFTER ADD LIQUIDITY

Pancakeswap Sniper Bot GUI Uniswap Matic 2022 (WINDOWS LINUX MAC) โญ๏ธ AUTO BUY TOKEN ON LAUNCH AFTER ADD LIQUIDITY โญ๏ธ โญ๏ธ First GUI SNIPER BOT for WINDO

Crypto Trader 1 Jan 05, 2022
Its The Basic Commands Of Termux

Its The Basic Commands Of Termux

ANKIT KUMAR 1 Dec 27, 2021
A telegram bot that can upload telegram media files to anonfiles.com and give you direct download link

โœฏ AnonFilesBot โœฏ Telegram Files to AnonFiles Upload Bot It will Also Give Direct Download Link Process : Fork This Repositry And Simply Cick On Heroku

Avishkar Patil 38 Dec 30, 2022
Yandex OSINT tool

YaSeeker Description YaSeeker - an OSINT tool to get info about any Yandex account using email or login. It can find: Fullname Photo Gender Yandex UID

HowToFind 110 Jan 03, 2023
Rotten Tomatoes API for Python

rottentomatoes.py rottentomatoes offers an easy-to-use Python wrapper to interact with the Rotten Tomatoes API. Before you try and use the API, make s

Zach Williams 88 Dec 15, 2022
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram VCVideoPlayBot An Telegram Bot By @ZauteKm To Stream Videos in Telegram Voice Chat. NOTE: Make sure you have started a VoiceChat in your Grou

Zaute 20 Oct 21, 2022
Python client for Midea dhumidifier

This is a library that allows communication with Midea dehumidifier appliances via the local area network. midea-beautiful-dehumidifier This library a

Nenad Bogojevic 42 Dec 22, 2022
๐€ ๐ฆ๐จ๐๐ฎ๐ฅ๐š๐ซ ๐“๐ž๐ฅ๐ž๐ ๐ซ๐š๐ฆ ๐†๐ซ๐จ๐ฎ๐ฉ ๐ฆ๐š๐ง๐š๐ ๐ž๐ฆ๐ž๐ง๐ญ ๐›๐จ๐ญ ๐ฐ๐ข๐ญ๐ก ๐ฎ๐ฅ๐ญ๐ข๐ฆ๐š๐ญ๐ž ๐Ÿ๐ž๐š๐ญ๐ฎ๐ซ๐ž๐ฌ !!

๐‡๐จ๐ฐ ๐“๐จ ๐ƒ๐ž๐ฉ๐ฅ๐จ๐ฒ For easiest way to deploy this Bot click on the below button ๐Œ๐š๐๐ž ๐๐ฒ ๐’๐ฎ๐ฉ๐ฉ๐จ๐ซ๐ญ ๐†๐ซ๐จ๐ฎ๐ฉ ๐’๐จ๐ฎ๐ซ๐œ๐ž๐ฌ ๐†๐ž๐ง๐ž?

Mukesh Solanki 1 Dec 10, 2021
trading strategy for freqtrade crypto bot it base on CDC-ActionZone

ft-action-zone trading strategy for freqtrade crypto bot it base on CDC-ActionZone Indicator by piriya33 Clone The Repository if you just clone this r

Miwtoo 17 Aug 13, 2022
Python Twitter API

Python Twitter Tools The Minimalist Twitter API for Python is a Python API for Twitter, everyone's favorite Web 2.0 Facebook-style status updater for

2.9k Dec 29, 2022
A pre-attack hacker tool which aims to find out sensitives comments in HTML comment tag and to help on reconnaissance process

Find Out in Comment Find sensetive comment out in HTML โšˆ About This is a pre-attack hacker tool that searches for sensitives words in HTML comments ta

Pablo Emรญdio S.S 8 Dec 31, 2022
DaProfiler vous permet d'automatiser vos recherches sur des particuliers basรฉs en France uniquement et d'afficher vos rรฉsultats sous forme d'arbre.

A but educatif seulement. DaProfiler DaProfiler vous permet de crรฉer un profil sur votre target basรฉ en France uniquement. La particularitรฉ de ce prog

Dalunacrobate 73 Dec 21, 2022
A play store search telegram bot

Play-Store-Bot A play store search telegram bot Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.c

Fayas Noushad 17 Oct 28, 2022