mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-11-14 12:13:15 +00:00
74a06e0b79cbd298a9971a1d2cb66e5c4e3214dd
Change how the old style on_error event is called to match the new style on_error event. Both are now called in case an exception is raised in an user defined event handler, and will by default print the arguments of the event tha raised the exception and the traceback for the exception. In addition, overridding the on_error handler supresses this behaviour.
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+.
ws4pylibraryrequestslibrary
Usually pip will handle these for you.
Related Projects
Languages
Python
100%