Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

gieseladev/discord.py

 
 

Repository files navigation

discord.py

NOTE:This is a fork of discord.py that is kept automatically up-to-date with the upstream/rewrite branch of discord.py. There are slight modifications which do not change any major core compatibility. Several gieseladev repositories and others pull from here. Targeted for Python >=3.6+ using rewrite with/without voice support.

Python Versions Maintained License

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.
  • 100% coverage of the supported Discord API.
  • Optimised in both speed and memory.

Installing

To install the development (rewrite) version, do the following:

# Linux/macOS
python3 -m pip install -U https://github.com/gieseladev/discord.py/archive/rewrite.zip#egg=discord.py[voice]

# Windows
py -3 -m pip install -U https://github.com/gieseladev/discord.py/archive/rewrite.zip#egg=discord.py[voice]

Optional Packages

  • PyNaCl (for voice support)

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

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

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')

client = MyClient()
client.run('token')

Bot Example

import discord
from discord.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

About

An API wrapper for Discord written in Python.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%