An API wrapper around Discord API written in Python

Overview

Diskord


This library is a maintained fork of now archived library, discord.py.

A modern and easy to use API wrapper around Discord API written in Python.

Features

  • Modern, Pythonic API based on async / await
  • Consistent, object oriented & easy to use interface
  • Provides full coverage of Discord API
  • Proper and sane ratelimit handling
  • Optimized in both speed and memory
  • Extensions support & prebuilt powerful commands handler

Installation

Python 3.8 or higher is required to install this library.

Basic Installation

To install the library without full voice support, you can just run the following command:

python -m pip install diskord

Voice Support

Optionally, To interact with discord's voice API, You would require voice support of this library which you can install like so:

python -m pip install diskord[voice]

Development Version

You must have git installed to install development version. Otherwise, you can download the code.

$ git clone https://github.com/nerdguyahmad/diskord
$ cd diskord
$ python -m pip install -U .[voice]

or in short;

python -m pip install git+https://github.com/diskord-dev/diskord.git

Quick Example

Here are some quick examples to give you a quickstart and show off the basic features of the library.

Application (Slash) Commands

import diskord

client = diskord.Client()

@client.slash_command(description='Ping-Pong!')
async def ping(ctx):
    await ctx.respond('Pong!')

client.run('token')

Legacy (Prefixed) Commands

import diskord
from diskord.ext import commands

bot = commands.Bot(command_prefix='>')

@bot.command()
async def ping(ctx):
    await ctx.send('pong')

bot.run('token')

You can find more examples in the examples directory.

Links

Comments
  • Bump aiohttp to a later version

    Bump aiohttp to a later version

    Summary

    Bump aiohttp to a later version

    Checklist

    • [ ] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [x] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    needs testing 
    opened by Hype3808 7
  • Added 2 missing permissions

    Added 2 missing permissions

    https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags

    Summary

    Add START_EMBEDDED_ACTIVITIES and MODERATE_MEMBERS permissions.

    Can be found on https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags

    Checklist

    • [x] If code changes were made then they have been tested.
      • [x] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [x] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    feature request 
    opened by Hype3808 4
  • SlashCommands object is not callable

    SlashCommands object is not callable

    Summary

    Just an error in pycharm with the lib

    Reproduction Steps

    import diskord
    from diskord.ext import commands
    bot = commands.Bot(command_prefix='!', application_command_guild_ids=834489585118740530)
    
    
    @bot.event
    async def on_ready():
        print('ready')
    
    
    @bot.slash_command()
    @diskord.application.option('text', description='The text to say!')
    async def say(ctx, text):
        await ctx.respond(f'{ctx.author.name} said: {text}')
    
    bot.run("")
    
    

    Using this code in PyCharm (from example but same result with my own code)

    Minimal Reproducible Code

    No response

    Expected Results

    0 error

    Actual Results

    Actually, i'm having this error "Object is not callable" for the SlashCommands object but when i run the code eveything is fine it's juste annoying that having 34 error but it's only like "fake error"

    Intents

    32767

    System Information

    • Python v3.9.7-final
    • diskord v2.6.1-final
    • aiohttp v3.7.4.post0
    • system info: Windows 10 10.0.22494

    Checklist

    • [X] I have searched the open issues for duplicates.
    • [X] I have shown the entire traceback, if possible.
    • [X] I have removed my token from display, if visible.

    Additional Context

    No response

    bug documentation typing 
    opened by dylanc24 4
  • Add Member.timeout

    Add Member.timeout

    Summary

    Added Member.timeout for ease of use

    Checklist

    • [ ] If code changes were made then they have been tested.
      • [x] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [x] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by MarzaElise 3
  • Make application commands register on `login`

    Make application commands register on `login`

    Summary

    Make application commands register on login instead of on_connect event so you don't have to manually register the slash commands when u call a on_connect.

    Checklist

    • [x] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [x] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, ...)

    Extra Checklist

    • [x] No errors have been raised when starting the bot

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by Hype3808 3
  • Implement thread starter message

    Implement thread starter message

    Summary

    So I added a method to diskord.Thread that fetches the message that the thread was created from. The method is called fetch_starter_message and it will return a diskord.Message. If the thread was created from a message, the message type will be default, otherwise it will be thread_starter_message. I also added a property called starter_message that will return the thread starter_message from the cache (can be None). The cache is updated everytime fetch_starter_message is called. This property can be useful when you don't want to make another API call after you already did.

    Checklist

    • [x] If code changes were made then they have been tested.
      • [x] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [x] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [x] This PR is not a code change (e.g. documentation, README, ...)
    feature request 
    opened by FlamptX 2
  • Help command with dropdown

    Help command with dropdown

    This is a help command made with the dropdown menu. The message will be always one (the bot will edit the same message and, of course, the dropdown menu will be always there) so there's no spam on the channel.

    opened by Tommodev-06 2
  • 2.5.1 -- Slash Extensions & Refactor : Refactor application commands to have instance attributes instead of properties

    2.5.1 -- Slash Extensions & Refactor : Refactor application commands to have instance attributes instead of properties

    1. Changed private callback properties into public attributes in ApplicationCommand class and SlashCommandChild class.
    2. A few very small PEP 8 fixes that I couldn't resist to leave like that :)

    From the 2.5.1 todo list, card link; https://github.com/diskord-dev/diskord/projects/2#card-69995521

    good first issue application commands hacktoberfest-accepted 
    opened by FlamptX 2
  • Add diskord to CC notice

    Add diskord to CC notice

    Summary

    Add diskord to CC notice

    Checklist

    • [ ] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [x] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by Hype3808 1
  • [documentation] Change favicon for docs

    [documentation] Change favicon for docs

    Summary

    Change favicon for docs

    Checklist

    • [ ] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [x] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by Hype3808 1
  • Create timeout.py

    Create timeout.py

    Summary

    This PR adds an example for the timeout feature (using the master branch version as specified at the top of the file).

    Checklist

    • [ ] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ x ] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [ x ] I have checked the open PRs and no PR exists like this one.
    • [ x ] My PR focuses on only one issue/change.
    opened by SpaceBar-Dev 1
  • Make slash command registration in `start`

    Make slash command registration in `start`

    Summary

    Make slash command registration in start

    I excidently deleted the fork so the previous one closed..

    Checklist

    • [x] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [x] This PR fixes an issue.
    • [ ] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by Hype3808 0
  • Slash attachments

    Slash attachments

    Summary

    Add support for slash attachments

    Checklist

    • [x] If code changes were made then they have been tested.
      • [ ] I have updated the documentation to reflect the changes.
    • [ ] This PR fixes an issue.
    • [x] This PR adds something new (e.g. new method or parameters).
    • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
    • [ ] This PR is not a code change (e.g. documentation, README, ...)

    Confirmations

    • [x] I have checked the open PRs and no PR exists like this one.
    • [x] My PR focuses on only one issue/change.
    opened by Hype3808 0
  • Webhook.edit_message leads to internal exception

    Webhook.edit_message leads to internal exception

    Summary

    Webhook.edit_message throws "AttributeError: PartialWebhookState does not support 'get_reaction_emoji'"

    Reproduction Steps

    My bot updates an embed on a regular cadence, so I store webhook urls in my database, then iterate through them. When posting the new embed, on some servers, I was seeing this in my logs.

    I tried with or without "webhook = await webhook.fetch()" to get the "full webhook" and still ran into the same exception. Seems like something on some servers is causing a path to look for reaction emoji.

    Minimal Reproducible Code

    async with aiohttp.ClientSession() as session:
                try:
                    webhook = diskord.Webhook.from_url(config.webhook, session=session)
                    webhook = await webhook.fetch()
                except diskord.InvalidArgument:
                    self.logging.error("Error: Webhook invalid. Disabling ID: {}".format(config.pk))
                    config.status = "Disabled"
                    config.save()
                    return
    
                try:
                    await webhook.edit_message(config.message_id, content="", embed=append_advert_if_needed(self.bot, config.server.pk, new_embed, lang=config.locale))
    
                except AttributeError as error:
                    #This is an error in the library
                    pass
    

    Expected Results

    No exception

    Actual Results

    Following exception was thrown.

    File "mycode/loopsv2.py", line 115, in update_message await webhook.edit_message(config.message_id, content="", embed=append_advert_if_needed(self.bot, config.server.pk, new_embed, lang=config.locale)) File "/lib/python3.9/site-packages/diskord/webhook/async_.py", line 1732, in edit_message message = self.create_message(data) File "/lib/python3.9/site-packages/diskord/webhook/async.py", line 1363, in _create_message return WebhookMessage(data=data, state=state, channel=channel) # type: ignore File "/lib/python3.9/site-packages/diskord/message.py", line 712, in init self.reactions: List[Reaction] = [ File "/lib/python3.9/site-packages/diskord/message.py", line 713, in Reaction(message=self, data=d) for d in data.get("reactions", []) File "/lib/python3.9/site-packages/diskord/reaction.py", line 90, in init ] = emoji or message.state.get_reaction_emoji(data["emoji"]) File "/lib/python3.9/site-packages/diskord/webhook/async.py", line 718, in getattr raise AttributeError(f"PartialWebhookState does not support {attr!r}.") AttributeError: PartialWebhookState does not support 'get_reaction_emoji'.

    Intents

    None

    System Information

    • Python v3.9.9-final
    • diskord v2.6.1-final
    • aiohttp v3.7.4.post0
    • system info: Linux 5.13.19-2-pve #1 SMP PVE 5.13.19-4 (Mon, 29 Nov 2021 12:10:09 +0100)

    Checklist

    • [X] I have searched the open issues for duplicates.
    • [X] I have shown the entire traceback, if possible.
    • [X] I have removed my token from display, if visible.

    Additional Context

    No response

    unconfirmed bug 
    opened by aldalen 0
  • Multiprocess Sharding(`IPC`) Module

    Multiprocess Sharding(`IPC`) Module

    Summary

    The creation of a ext.ipc module based off the Ext-Creators one

    What is the feature request for?

    The core library

    The Problem

    Having to host both the bot and server on the same server

    The Ideal Solution

    Creating the ipc.Session and ipc.Server processes for creating Sessions which interact with the Server separately

    from diskord.ext import ipc, commands
    
    session = ipc.Server(...)
    
    bot = commands.Bot(...)
    
    @session.route(...)
    async def get_member_count(data):
        guild = bot.get_guild(data.guild_id)
    
        return guild.member_count
    
    

    and a Server process in a different server

    from sanic import Sanic
    from diskord.ext import ipc
    
    server = Sanic(__name__)
    session = ipc.Session(...)
    
    @server.route("/")
    async def index():
        req_str = await session.request(...)
    
        return str(req_str)
    

    The stuff above are mostly based off the discord-ext-ipc examples.

    The Current Solution

    No response

    Additional Context

    No response

    feature request 
    opened by VincentRPS 0
  • Support for cooldowns within Application Commands

    Support for cooldowns within Application Commands

    Summary

    Being able to use cooldowns and max concurrency on slash commands

    What is the feature request for?

    The core library

    The Problem

    having users execute commands too fast or use commands such as economy without proper cooldowns

    The Ideal Solution

    just adding them mostly based of current cooldowns and max concurrency

    The Current Solution

    No response

    Additional Context

    No response

    feature request 
    opened by VincentRPS 0
  • Converters raising attribute error.

    Converters raising attribute error.

    Summary

    commands.Greedy not working

    Reproduction Steps

    import diskord
    from diskord.ext import commands
    
    class Test(commands.Cog):
    	def __init__(self, client):
    		self.client = client
    	
    	
    	@diskord.application.slash_command()
    	@diskord.application.option("channels", required = True)
    	async def test(self, ctx, *, channels : commands.Greedy[diskord.TextChannel]):
    		pass
    		
    
    
    
    def setup(client):
    	client.add_cog(Test(client))
    

    Minimal Reproducible Code

    No response

    Expected Results

    No error

    Actual Results

    Gives the error: AttributeError: 'Greedy' object has no attribute '__name__'

    Full error: https://pastebin.com/pBRwzjkm

    Intents

    None

    System Information

    • Python v3.9.7-final
    • diskord v2.6.1-final
    • aiohttp v3.7.4.post0
    • system info: Linux 4.9.82-perf+ #2 SMP PREEMPT Sat Mar 6 01:27:24 CST 2021

    Checklist

    • [X] I have searched the open issues for duplicates.
    • [X] I have shown the entire traceback, if possible.
    • [x] I have removed my token from display, if visible.

    Additional Context

    No response

    bug application commands 
    opened by RyZeDZ 1
Releases(v2.6.2)
  • v2.6.2(Nov 6, 2021)

    Breaking Changes

    • Autocomplete callbacks now take Option as a second parameter before interaction and after value.
    • Removed ignore_guild_register_fail from commands registration methods.
    • Guild IDs related to application commands now default to None instead of empty list.
      • Client.application_commands_guild_ids now default to None.
      • ApplicationCommand.guild_ids now default to None.
    • Redesigned application commands registration.
      • Guild commands are bulk overwritten on every call.
      • Global commands are not re-registered if they are not updated.
      • sync_application_commands now bulk overwrites guild commands. Use Client.create_application_command instead.

    Additions

    • Add support for bypassing registration process by adding id parameter in application command.
    • Add support for guild boosts progress bar.
    • Add diskord.Client.create_application_command

    Bug Fixes

    • Fix reference error on guild command registration fail.
    • Duplicate guild IDs in application commands are now properly ignored.
    • Fix type kwarg being ignored by diskord.application.option decorator.
    • Other minor fixes.

    Documentation also has been fixed and now has proper hyperlinks on attributes.

    Source code(tar.gz)
    Source code(zip)
  • v2.6.1(Oct 23, 2021)

    • Add support minimum and maximum values on slash commands options
      • Add application.Option.min_value
      • Add application.Option.max_value
    • Rename Client.application_commands_guild_ids to Client.application_command_guild_ids
    • Client.application_commands is now a list instead of ID to command mapping.
    • Fix NameError on guilds commands registration failing to register
    • Fix application.ApplicationCommand.default_permissions not working at all.
    • Fix repr(ApplicationCommand) raising AttributeError
    • Fix getters and fetchers from Guild for commands not working at all.
    Source code(tar.gz)
    Source code(zip)
  • 2.6.0(Oct 18, 2021)

    Breaking Changes

    • Rename diskord.slash_option decorator to diskord.application.option
    • Move user constructable application commands classes to application namespace.
    • Rename on_application_command_run to on_application_command
    • Application Commands are now handled internally like components. Client.process_application_commands has been removed.
    • Application commands permissions rework. See the relevant documentation for more details.

    Additions

    • Implement autocompletion for slash commands options (#15)
    • Implement support for sending files in diskord.InteractionResponse.send_message
    • Add diskord.application.ApplicationCommand.extras to diskord.application.ApplicationCommand (#11)
    • Add application_commands_guild_ids parameter to diskord.Client to prevent bot from creating global commands.
    • Add diskord.ApplicationCommand.edit and diskord.ApplicationCommand.delete methods.
    • Rename diskord.Client.get_application_context to diskord.Client.get_interaction_context

    Improvements

    • diskord.application.ApplicationCommand.callback is now settable.
    • Converters can now be determined by the option annotations in slash commands.

    Bug Fixes

    • Fix role icons not being set properly.
    • Fix previous options for application commands getting re-added after command has been removed and added back to pending commands list.
    • Fix user option resolving to None in slash commands if member intents are missing.
    • Fix files raising AttributeError
    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(Oct 3, 2021)

  • v2.5.0(Oct 2, 2021)

    • Support for Application Commands :tada:
    • Partial Support for Application Commands extensions.
    • Support for role icons
    • Support guild welcome screen
    • Add raw_thread_delete event
    • Add raw_typing events

    https://diskord.readthedocs.io/en/latest/migrating.html https://diskord.readthedocs.io/en/latest/application_commands.html

    Source code(tar.gz)
    Source code(zip)
Owner
Diskord
An API wrapper around Discord API, Originated as a fork of discord.py
Diskord
A simple API wrapper for Discord written in Python.

AIOCord This project is work in progress not for production use A simple asynchronous API wrapper around Discord API written in Python. Inspiration Th

Izhar Ahmad 3 Dec 07, 2021
A simple bot to upload file to various cloud servers.

Cloudsy Bot A simple bot to upload file to various cloud servers. Variables API_HASH Your API Hash from my.telegram.org API_ID Your API ID from my.tel

Flying Santas 8 Oct 31, 2022
Telegram Group Manager Bot + Userbot Written In Python Using Pyrogram.

Telegram Group Manager Bot + Userbot Written In Python Using PyrogramTelegram Group Manager Bot + Userbot Written In Python Using Pyrogram

1 Nov 11, 2021
A python interface for interacting with the Ethereum blockchain and ecosystem.

Web3.py A Python library for interacting with Ethereum, inspired by web3.js. Python 3.6+ support Quickstart Get started in 5 minutes or take a tour of

3.9k Jan 03, 2023
Discord Token Nuker With Python

Discord token nuker a.k.a A$$Fvcker Setup For installing the requirements do this: pip install -r requirements.txt To start the Token nuker run this

PR3C14D0 8 Sep 22, 2022
Discord-Bot - Bot using nextcord for beginners

Discord-Bot Bot using nextcord for beginners! Requirements: 1 :- Install nextcord by typing "pip install nextcord" Thats it! You can use this code any

INFINITE_. 3 Jan 10, 2022
Demo of using Telegram to send alert message

MIAI_Telegram Demo of using Telegram to send alert message Video link: https://youtu.be/oZ9CsIrlMgg #MìAI Fanpage: http://facebook.com/miaiblog Group

4 Jun 20, 2021
Framework for creating and running trading strategies. Blatantly stolen copy of qtpylib to make it work for Indian markets.

_• Kinetick Trade Bot Kinetick is a framework for creating and running trading strategies without worrying about integration with broker and data str

Vinay 41 Dec 31, 2022
An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild

Hyrule Compendium API An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild. B

Aarav Borthakur 116 Dec 01, 2022
Disco is an extensive and extendable Python 2.x/3.x library for the Discord API.

disco Disco is an extensive and extendable Python 2.x/3.x library for the Discord API. Disco boasts the following major features: Expressive, function

1 Nov 18, 2021
D-Ticket is a discord bot for ticket system

D-Ticket Discord Bot D-Ticket is a discord bot for ticket management system. This is not final product is currently being in development stay connecte

DeViL 1 Jan 06, 2022
Automate TikTok follower bot, like bot, share bot, view bot and more using selenium

Zefoy TikTok Automator Automate TikTok follower bot, like bot, share bot, view bot and more using selenium. Click here to report bugs. Usage Download

555 Dec 30, 2022
Projeto com o objetivo de aprender o funcionamento de Consumo de APIs.

Consumindo API SuperHero Projeto com o objetivo de aprender o funcionamento de Consumo de APIs.

Deivisson Henrique 1 Dec 30, 2021
Fast and small Discord-Toolset.

Mooncord 🌙 Discord server: https://discord.gg/frnpk2rg Fast and small Discord-Toolset. Enjoy? Star this repo ⭐ (Main file in Mooncord/Moon-1.0.1/vers

7ua 9 Dec 11, 2021
The Encoder Bot For Python

The_Encoder_Bot Configuration Add values in environment variables or add them in config.env.example and rename file to config.env. Basics API_ID - Get

8 Jan 01, 2022
Bearer API client for Python

Bearer Python Bearer Python client Installation pip install bearer Usage Get your Bearer Secret Key and integration id from the Dashboard and use the

Bearer 9 Oct 31, 2022
Valorant store offer discord-bot

Valorant store checker - Discord Bot Discord bot that shows your daily store offer without open the VALORANT by using the Ingame API. written using Py

STACIA 226 Jan 02, 2023
discord token grabber scam - eductional purposes only!

Discord-QR-Scam תופס אסימון תמונה של Discord על אודות סקריפט Python שיוצר אוטומטית קוד QR הונאה של Nitro ותופס את אסימון הדיסקורד בעת סריקה. כלי זה מד

Amit Pinchasi 0 May 22, 2022
Simple Python Auto Follow Bot

Instagram-Auto-Follow-Bot Description Một IG BOT đơn giản. Tự động follow những người mà bạn muốn cướp follow. Tự động unfollow. Tự động đăng nhập vào

CodingLinhTinh 3 Aug 27, 2022
PYthon Warframe Market API(pywmapi)

pywmapi PYthon Warframe Market API(pywmapi) API for warframe market, written in Python. For now, the implemented function is listed below: auth sign i

AyajiLin 7 Dec 11, 2022