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
💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!

LocalStack - A fully functional local AWS cloud stack LocalStack provides an easy-to-use test/mocking framework for developing Cloud applications. Cur

LocalStack 45.3k Jan 02, 2023
a Music bot for discord

Bot this is a discord bot made by AnHalfGuy.py#6031(ID: 747864072879603743) and HastagStopAnimalAbuse#5617(ID :349916852308279306) This Bot Is For Mus

A Discord Bot Development 1 Oct 29, 2021
The most annoying bot on Discord

FBot The most annoying bot on discord Features Lots of fun stuff Message responses, sort of our main feature, no big deal. FBot can respond to a wide

Jude 33 Jun 25, 2022
GitHub Actions Docker training

GitHub-Actions-Docker-training Training exercise repository for GitHub Actions using a docker base. This repository should be cloned and used for trai

GitHub School 1 Jan 21, 2022
Prime Mega is a modular bot running on python3 with autobots theme and have a lot features.

PRIME MEGA Prime Mega is a modular bot running on python3 with autobots theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Cre

『TØNIC』 乂 ₭ILLΣR 45 Dec 15, 2022
A free tempmail api for your needs!

Tempmail A free tempmail api for your needs! Website · Report Bug · Request Feature Features Add your own private domains Easy to use documentation No

dropout 10 Oct 26, 2021
Automatically kick deleted accounts

AntiDeletedAccountsBot (ADAB) Automatically kick deleted accounts Based on uniborg, a pluggable asyncio Telegram userbot based on Telethon. Installati

Qwerty-Space 34 Jan 02, 2023
Kanata Bot - a modular bot running on python3 with anime theme and have a lot features

Kanata Bot Kanata Bot is a modular bot running on python3 with anime theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Create

Rikka-Chan 2 Jan 16, 2022
This is a story bot, that will scrape stories from r/stories subreddit and convert it into an Audio File.

Introduction This is a story bot, that will scrape stories from r/stories subreddit and convert it into an Audio File. Installation pip install -r req

Yasho 11 Jun 30, 2022
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase 📌 Links |Join the discord

Pincer 125 Dec 26, 2022
Auto-commiter - Auto commiter Github

auto committer Github Follow the steps below to use this repository: 1-install c

Arman Ebtekari 8 Nov 14, 2022
Validate all your Customer IAM Policies against AWS Access Analyzer - Policy Validation

✅ Access Analyzer - Batch Policy Validator This script will analyze using AWS Access Analyzer - Policy Validation all your account customer managed IA

Victor GRENU 41 Dec 12, 2022
HackerNews and Reddit in one placce

EDIT: this project is 3.5 years old. I found it sad it's just laying around, so I did some minimal fixes and deployed it. Hope you enjoy! (PR's welcom

Hugo Montenegro 1 Nov 13, 2021
A bot can play all variants, but standard are abit weak, so if you need strongest you can change fsf instead of stockfish_14_Dev

MAINTAINERS Drdisrespect1 and drrespectable lichess-bot Engine communication code taken from https://github.com/ShailChoksi/lichess-bot by ShailChoksi

RPNS Nimsilu 1 Dec 12, 2021
Unofficial YooMoney API python library

API Yoomoney - unofficial python library This is an unofficial YooMoney API python library. Summary Introduction Features Installation Quick start Acc

Aleksey Korshuk 136 Dec 30, 2022
Rock API is an API that allows you to view rocks and find the ratings on them

Rock API The best Rock API What is Rock API? Rock API is an API that allows you to view rocks and find the ratings on them. However, this isn't a regu

Conos 21 Sep 21, 2022
A quick way to verify your Climate Hack.AI (2022) submission locally!

Climate Hack.AI (2022) Submission Validator This repository contains code that allows you to quickly validate your Climate Hack.AI (2022) submission l

Jeremy 3 Mar 03, 2022
Some examples regarding how to use the Twitter APIs for academic research

Twitter Developer Platform: Using Twitter APIs for Academic Research All the scripts require a config.ini file in which the keys are put. There is a t

Federico Bianchi 6 Feb 13, 2022
A discord bot that can detect Nitro Scam Links and delete them to protect other users

A discord bot that can detect Nitro Scam Links and delete them to protect other users. Add it to your server from here.

Kanak Mittal 9 Oct 20, 2022
Who are we? We are the Hunters of all Torrent in this world.🗡️.Fork from SlamDevs

MIRROR HUNTER This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. Repo la

Anime Republic 130 May 28, 2022