You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rapptz 81aa76021a Update README. 10 years ago
discord Add the ability to kick, ban and unban users from a server. 10 years ago
docs Add on_server_create and on_server_delete events. 10 years ago
examples Add the ability to edit messages. 10 years ago
.gitignore Return the message created when calling send_message 10 years ago
LICENSE Rename project from pydiscord to discord.py 10 years ago
MANIFEST.in Add MANIFEST file for pip. 10 years ago
README.md Update README. 10 years ago
requirements.txt Initial commit 10 years ago
setup.py Add support for channel creation events. 10 years ago

README.md

discord.py

discord.py is an API wrapper for Discord written in Python.

This was written to allow easier writing of bots or chat logs.

Installing

Installing is pretty easy.

pip install discord.py

Will install the latest 'stable' version of the library.

This module is alpha!

The discord API is constantly changing and the wrapper API is as well. There will be no effort to keep backwards compatibility.

I recommend that you follow the discussion in the unofficial Discord API discord channel and update your installation periodically through pip install --upgrade discord.py.

Quick Example

import discord

client = discord.Client()
client.login('email', 'password')

@client.event
def on_message(message):
    if message.content.startswith('!hello'):
        client.send_message(message.channel, 'Hello was received!')

@client.event
def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

client.run()

You can find examples in the examples directory.

Requirements

  • Python 2.7+ or Python 3.3+.
  • ws4py library
  • requests library

Usually pip will handle these for you.