5e671a0d0ddcba46581aea5bd9d8bb887498036d
				
			
			
		
	Move the socket message handling and Discord connection state tracking out of the Client class. The WebSocket class handles the ws4py based WebSocket to Discord, maintains the keepalive and dispatches socket_<events> based on activity. The ConnectionSTate class maintains the state associated with the WebSocket connection with Discord. In a reconnect and switch gateway scenario this state can be kept for a faster and less disruptive recovery.
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+.
- ws4pylibrary
- requestslibrary
Usually pip will handle these for you.
Related Projects
Description
				
					Languages
				
				
								
								
									Python
								
								100%