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
Análise de dados abertos do programa Taxigov.

Análise de dados do Taxigov Este repositório contém os cadernos Jupyter usados no projeto de análise de dados do Taxigov. Conjunto de dados O conjunto

Augusto Herrmann 1 Jan 10, 2022
Account Profiles Dumper for Fortnite.

Fortnite Profile Dumper This program allows you to dump your Fortnite account profiles. How to use it? After starting the FortniteProfileDumper.py, yo

PRO100KatYT 12 Jul 28, 2022
Ma2tl - macOS forensic timeline generator using the analysis result DBs of mac apt

ma2tl (mac_apt to timeline) This is a DFIR tool for generating a macOS forensic

Minoru Kobayashi 66 Nov 18, 2022
Source code of BobuxAdmin bot from Bobux Bot Development server.

BobuxAdmin Source code of BobuxAdmin bot from Bobux Bot Development server. The bot is written with usage of disnake and SQLite database. Functionalit

Bobux Bot Developers 3 Dec 29, 2022
Basic Python3 request wrapper for the PancakeSwap API

🐍 Python Pancakes 🥞 A simple request wrapper for the Pancake-Swap API. Installation Install package # Using pip $ pip install pythonpancakes # Or f

Scott Burlovich 30 Nov 20, 2022
A Dm Bot, also knows as Mass DM bot which can send one message to All of the Users in a Specific Server!

Discord DM Bot discord.py 1.7.2 python 3.9.5 asyncio 3.4.3 Installation Cloud Host Tutorial uploaded in YouTube, watch it by clicking here. Local Host

hpriyam8 7 Mar 24, 2022
Async wrapper over hentaichan.live

hentai-chan-api-async is a small asynchronous parser library that will allow you to easily use manga from https://hentaichan.live Recommended to use python3.7+

7 Dec 15, 2022
A python API for BSCScan (Binance Smart Chain Explorer), available on PyPI.

bscscan-python A complete Python API for BscScan.com, available on PyPI. Powered by BscScan.com APIs. This is a gently modified fork of the etherscan-

Panagiotis Kotsias 246 Dec 31, 2022
Parse 11.000 free proxies!

Proxy Machine Description I did this project in order to boost views with the teleboost ✈️ in my Telegram channel. You can use it not only for boostin

VLDSLV 77 Jan 08, 2023
Debugging with Stack Overflow: Web Search Behavior in Novice and Expert Programmers

Debugging with Stack Overflow: ICSE SEET, 2022 This is the GitHub repository associated with the 2022 ICSE SEET paper, Debugging with Stack Overflow:

Madeline Endres 1 Jan 31, 2022
A Powerful Discord Webhook spammer

RocketHook | The discord spammer Some links: Telegram | Github FEATURES 🤖 Hide your ass and be a good robot ! Full proxies support HTTP/S, SOCKS4/5 S

Or 2 Feb 27, 2022
A python bot that will allow you to have maximum luck during Veve drops.

VeveBot You can follow me here Github | Twitter Features: - Click on the purchase at the time of the drop. - Be able to choose to do more than one tes

Rodz 1 Dec 04, 2021
Halcyon is a Matrix bot library created with the intention of being easy to install and use. Inspired by discord.py

Halcyon is a Matrix bot library with the goal of being easy to install and use. The library takes inspiration from discord.py and the Slack li

Wes Ring 19 Jan 06, 2023
“ HOLA HUMANS 👋 I'M DAISYX 2.0 ❤️ „ LATEST VERSION OF DAISYX.. Source Code of @Daisyxbot

❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... ⭐️ Thanks to everyone who starred Dais

TeamDaisyX 153 Dec 06, 2022
Spore API wrapper written in Python

A wrapper for the Spore API that simplifies and complements its functionality

1 Nov 25, 2021
Python API for working with RESQML models

resqpy: Python API for working with RESQML models Introduction resqpy is a pure python package which provides a programming interface (API) for readin

BP 44 Dec 14, 2022
Python JIRA Library is the easiest way to automate JIRA. Support for py27 was dropped on 2019-10-14, do not raise bugs related to it.

Jira Python Library This library eases the use of the Jira REST API from Python and it has been used in production for years. As this is an open-sourc

PyContribs 1.7k Jan 06, 2023
An open source API to validate the EU Covid Certificates / Green Certificates

Open Covid Certificate Validator This an open source API to validate EU Digital COVID Certificates. It receives a COVID certificate and validates it u

Merlin Schumacher 47 May 30, 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 compatability shim between Discord.py and Hikari.

Usage as a partial shim: import discord import hikari import hikari_shim dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=

EXPLOSION 3 Dec 25, 2021