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
TwitterBot-ImageCollector - Twitter bot that collects images from likes saves the image

TwitterBot-ImageCollector Bot de Twitter que recolecta imagenes a partir de los

Gx3 Studios 4 Jun 01, 2022
Stack overflow search API

Stack overflow search API

Vikash Karodiya 1 Nov 15, 2021
This bot can stream audio or video files and urls in telegram voice chats :)

Voice Chat Streamer This bot can stream audio or video files and urls in telegram voice chats :) 🎯 Follow me and star this repo for more telegram bot

Anjana Madu 63 Dec 25, 2022
Efetuar teste de automação usando linguagem gherkin

🚀 Teste-de-Automação - QA---CI-T 🚀 Descrição • Primeira Parte • Segunda Parte • Terceira Parte Contributors Descrição Efetuamos testes de automação

Eliel martins 6 Dec 07, 2021
A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studying.

Studying RPC Description A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studyin

John Edmerson Pizarra 4 Nov 19, 2022
NewpaperNews-API - Json data of the news with python

NewsAPI API Documentation BASE_URL = "https://saurav.tech/NewsAPI/" top_headline

Aryaman Prakash 2 Sep 23, 2022
Repositorio dedicado a contener los archivos fuentes del bot de discord "Lector de Ejercicios".

Lector de Ejercicios Este bot de discord está pensado para usarse únicamente en el discord de la materia Algoritmos y Programación I, de la Facultad d

Franco Lighterman Reismann 3 Sep 17, 2022
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
A repo-watcher to watch for commits on a repo an trigger GitHub action by sending a `repository_dispatch` event to destinantion repo

repo-watcher-dispatch-sender This app is used to send a repository_dispatch event to the destination repo set in config.py or Environmental Variables

Divide Projects™ 2 Feb 06, 2022
LoL 台版10周年活動自動輸入邀請碼

LoLTW_10Year_88Event LoLTW 8.8 周年慶 邀請碼自動輸入 設定 在 LoLTW_10Year_88Evnet.exe 的位置建立一個檔案 .env,內容如下 Bahamut_Discussion = https://forum.gamer.com.tw/C.php?bsn

古丁丁 5 Dec 13, 2021
A bot to get Statistics like the Playercount from your Minecraft-Server on your Discord-Server

Hey Thanks for reading me. Warning: My English is not the best I have programmed this bot to show me statistics about the player numbers and ping of m

spaffel 12 Sep 24, 2022
Skautský discord bot

Jáchym 🤖 Open-source skautský discord bot postavený na discord.py O čem? • Funkce • TODO • Poděkování ❓ O čem? Jáchym vznikl jako projekt do odborky

10 May 12, 2022
Script que realiza a identificação de todos os logins e senhas dos wifis conectados em uma máquina e envia os dados para um e-mail especificado.

getWIFIConnection Script que realiza a identificação de todos os logins e senhas dos wifis conectados em uma máquina e envia os dados para um e-mail e

Vinícius Azevedo 3 Nov 27, 2022
A telegram media to gofile bot

GoFile-Bot A telegram media to gofile bot Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/Fay

Fayas Noushad 37 Nov 14, 2022
A simple but useful Discord Selfbot with essential features, made with discord.py-self.

Discord Selfbot Xyno Discord Selfbot Xyno is a simple but useful selfbot for Discord. It has currently limited useful features but it will be updated

Amit Pathak 7 Apr 24, 2022
A Python module for communicating with the Twilio API and generating TwiML.

twilio-python The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio AP

Twilio 1.6k Jan 05, 2023
This is telegram bot to generate string session for using user bots. You can see live bot in https://telegram.dog/string_session_Nsbot

TG String Session Generate Pyrogram String Session Using this bot. Demo Bot: Configs: API_HASH Get from Here. API_ID Get from Here. BOT_TOKEN Telegram

Anonymous 27 Oct 28, 2022
A simple script & container to pull COVID data from covidlive.com.au and post a summary to a slack channel

CovidLive AU Summary Slackbot This bot is a very simple slackbot that pulls data, summarises and posts up to date AU COVID stats to a provided slack c

James 3 Dec 18, 2021
Check your bot status automatically using userbot, simply and easy

Status Checker Userbot check your bot status automatically using userbot, simply and easy. Mandatory Vars API_ID : Telegram API_ID, get it from my.tel

ALBY 6 Feb 20, 2022
An anime themed telegram group management bot based on sqlalchemy database running on python3.

Kazuko Robot A Telegram Python bot running on python3 forked with saitama and DiasyX with a sqlalchemy database and an entirely themed persona to make

heyaaman 22 Dec 07, 2022