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
Plugin for Sentry which allows sending notification via Telegram messenger.

Sentry Telegram Plugin for Sentry which allows sending notification via Telegram messenger. Presented plugin tested with Sentry from 8.9 to 9.1.1. DIS

Shmele 208 Dec 30, 2022
Properly-formatted dynamic timestamps for Discord messages

discord-timestamps discord-timestamps generates properly-formatted dynamic timestamps for Discord messages, with support for Arrow objects. format

Ben Soyka 2 Mar 10, 2022
A working bypass for discord gc spamming

IllusionGcSpammer A working bypass for discord gc spamming Installation Run pip install pip install DiscordGcSpammer then your good to go. Usage You c

6 Sep 30, 2022
LEC_Ditto is a bot that tracks the follows and unfollows of Twitter accounts

✨ LEC_Ditto ✨ I'm Ditto, and I'm a bot 🤖 . Getting Started | Installation | Usage Getting Started LEC_Ditto is a bot that tracks the follows and unfo

2 Mar 30, 2022
A wrapper for slurm especially on Taiwania2 (HPC CLI)A wrapper for slurm especially on Taiwania2 (HPC CLI)

TWCC-slurm-wrapper A wrapper for slurm especially on Taiwania2 (HPC CLI). For Taiwania2 (HPC CLI) usage, please refer to here. (中文) How to Install? gi

Chi-Liang, Liu 5 Oct 07, 2022
Using DST's API with Python

A short guide on how to access Denmark's Statistics API with python, together with a helper class that facilitates the collection of data and metadata from any DST's table

Alessandro Martinello 16 Dec 02, 2022
DISCORD script to automate sending messages to a particular server

discord discord script This script sends random quotes to an discord server and tags random users on the server in the process MADE WITH LOVE BY SACS

Solomon ogu 1 Nov 06, 2021
Posts word definitions on Twitter daily

Word Of The Day bot Post daily word definitions on social media. Twitter account: https://twitter.com/WordOfTheDay_B Introduction The goal of this pro

Lucas Rijllart 1 Jan 08, 2022
Stock trading bot made using the Robinhood API / Python library...

High-Low Stock trading bot made using the Robinhood API / Python library... Index Installation Use Development Notes Installation To Install and run t

Reed Graff 1 Jan 07, 2022
Schedule Twitter updates with easy

coo: schedule Twitter updates with easy Coo is an easy to use Python library for scheduling Twitter updates. To use it, you need to first apply for a

wilfredinni 46 Nov 03, 2022
Import Notion Tasks to

Notion-to-Google-Calendar (1 way) Import Notion Tasks to Google Calendar NO MORE UPDATES WILL BE MADE TO THIS REPO. Attention has been put on a 2-way

12 Aug 11, 2022
Unofficial Meteor Client wiki

Welcome to the Unofficial Meteor Client wiki! Meteor FAQs | A rewritten and better FAQ page. Installation Guide | A guide on how to install Meteor Cli

Anti Cope 0 Feb 21, 2022
A complete Python application to automatize the process of uploading files to Amazon S3

Upload files or folders (even with subfolders) to Amazon S3 in a totally automatized way taking advantage of: Amazon S3 Multipart Upload: The uploaded

Pol Alzina 1 Nov 20, 2021
The fastest nuker on discord, Proxy support and more

About okuru nuker is a nuker for discord written in python, It uses methods such as threading and requests to ban faster and perform at higher speeds.

63 Dec 31, 2022
Telegram bot that let's you flip a coin in a dialog

coin_flip Telegram bot that let's you flip a coin in a dialog Report issue · Request feature About Software development tool that lets you finally dec

Ivan Akostelov 2 Dec 12, 2021
Cytotron - A unique discord bot like never before. Add it to your server to keep it active, motiviated, and amazing!!

Cytotron - Take your server to the next level Most of the details are in the website. Go to https://cytotron-bot.gq for more information. If that link

LeviathanProgramming 6 Jun 13, 2021
Unofficial Coinbase Python Library

Unofficial Coinbase Python Library Python Library for the Coinbase API for use with three legged oAuth2 and classic API key usage Version 0.3.0 Requir

George Sibble 104 Dec 01, 2022
GTPS Status Bot

Python GTPS Status Bot (BETA) Python GTPS Status Bot Require Python How To Use Download This Source Extract The Zip File Install the requirements (Mod

Lamp 4 Oct 11, 2021
Kakatua discord music bot

Donate Ayo donasi! Lokal Internasional Ucapan Terima Kasih Tentu saja, donatur Bunga dan talent-talent h!mawari. Semoga rezeki teman-teman semakin lan

1 Oct 30, 2021
A mood based crypto tracking application.

Crypto Bud - API A mood based crypto tracking application. The main repository is private. I am creating the API before I connect everything to the ma

Krishnasis Mandal 1 Oct 23, 2021