kreativermario/discord.py


License: MIT

Language: Python


discord.py

Discord server invite PyPI version info PyPI supported Python versions

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

Key Features

  • Modern Pythonic API using async and await.
  • Proper rate limit handling.
  • Optimised in both speed and memory.

Installing

Python 3.8 or higher is required

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

# Linux/macOS
python3 -m pip install -U discord.py

# Windows
py -3 -m pip install -U discord.py

Otherwise to get voice support you should run the following command:

# Linux/macOS
python3 -m pip install -U "discord.py[voice]"

# Windows
py -3 -m pip install -U discord.py[voice]

To install the development version, do the following:

$ git clone https://github.com/Rapptz/discord.py
$ cd discord.py
$ python3 -m pip install -U .[voice]

Optional Packages

Please note that when installing voice support on Linux, you must install the following packages via your favourite package manager (e.g. apt, dnf, etc) before running the above commands:

  • libffi-dev (or libffi-devel on some systems)
  • python-dev (e.g. python3.8-dev for Python 3.8)

Quick Example

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run('token')

Bot Example

import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=intents)

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

bot.run('token')

You can find more examples in the examples directory.

Links

Project Statistics

Sourcerank 3
Repository Size 7.99 MB
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 0
Contributors 356
Tags 72
Created
Last updated
Last pushed

Top Contributors See all

Danny Nadir Chowdhury Josh khazhyk Jakub Kuczys Steve C z03h Hornwitser Stocker apple502j Lilly Rose Berner Alex Nørgaard ioistired Devon R Bryan Forbes Andrin Imayhaveborkedit Maya James Hilton-Balfe Izhar Ahmad

Recent Tags See all

v2.2.2 March 02, 2023
v2.2.1 March 02, 2023
v2.2.0 February 28, 2023
v2.1.1 February 09, 2023
v2.1.0 November 12, 2022
v2.0.1 August 27, 2022
v2.0.0 August 18, 2022
v1.7.3 June 12, 2021
v1.7.2 May 03, 2021
v1.7.1 April 06, 2021
v1.7.0 April 04, 2021
v1.6.0 January 08, 2021
v1.5.1 October 19, 2020
v1.4.2 September 29, 2020
v1.5.0 September 29, 2020

Something wrong with this page? Make a suggestion

Last synced: 2023-07-08 21:10:10 UTC

Login to resync this repository