aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix documentation warnings.Rapptz2015-10-221-6/+6
|
* Change default parameter to None for Client.set_channel_permissionsRapptz2015-10-221-1/+4
|
* Add Client.delete_channel_permissionsRapptz2015-10-221-0/+20
| | | | Fixes #18
* Add Client.set_channel_permissionsRapptz2015-10-221-0/+47
|
* Print to stderr in on_errorHornwitser2015-10-221-1/+5
| | | | | | | | | | | | | | | Apparently the clever hack for logging in on_error was not so clever after all. If logging isn't configured, by the logging modules definition of not configured, which is root logger not having an Handlers attached, it will call logging.basicConfig(). Which messes up setups that define handlers for other loggers than the root logger. Going directly to the root logger rather than using the broken convenience methods for logger is not an option either, as logger before Python 3.2 does not have lastResort on the root logger, and prints an error when invoked without any handlers. Resolve by printing tracebacks to stderr by default in on_error.
* Add note for edit_role about custom RGB colours.Rapptz2015-10-211-0/+7
|
* Better detection for the everyone role. Fixes #23.Rapptz2015-10-211-3/+6
|
* Add Client.replace_rolesRapptz2015-10-211-2/+33
|
* Add Client.add_roles and Client.remove_rolesRapptz2015-10-211-0/+59
|
* Log to root logger by default in on_errorHornwitser2015-10-211-2/+1
| | | | | | | | | | | | | | Change the default implementation of on_error to log to the root logger instead of discord.client and clarify that the exception is being ignored. This ensures that a message will be output to standard error in case the logging module has not been configured. Also removes the argument printing for the default on_error, this is due to them often being too long, that they could cause another exception to be thrown, and because it sometimes causes sensitive information to be output such as Discord tokens and session ids. It was also possible for the length to get in the megabyte range with exceptions thrown by on_socket_raw_receive in READY events.
* Fix Client.create_invite invalid method call issue.Rapptz2015-10-201-1/+1
|
* Change default limit for Client.logs_from to 100.Rapptz2015-10-191-1/+1
|
* Add Client.create_role to create a server-wide role.Rapptz2015-10-171-0/+22
|
* Change Client.edit_role to be less stateful.Rapptz2015-10-171-18/+23
|
* on_socket_response now handles non-op 0 websocket messages.Rapptz2015-10-161-5/+8
|
* Use compact encoding for json on websocketHornwitser2015-10-161-2/+2
| | | | | Remove extra whitespace from json encoding used when sending messages on the websocket.
* Add events for sniffing the WebSocket dataHornwitser2015-10-161-0/+5
| | | | | | | Add on_socket_raw_receive and on_socket_raw_send events for sniffing the data being received and sent on the websocket. Useful for debugging and logging websocket messages received and sent on the link to Discord's servers.
* Separate colour tuple into its own class.Rapptz2015-10-161-1/+2
| | | | | Also enumerate all the constant colours that Discord currently supports.
* Handle VOICE_STATE_UPDATE websocket events.Rapptz2015-10-151-1/+18
| | | | | | | | | | | This adds a lot of new attributes into the Member class such as giving a voice_channel that the user is currently connected to. Initially there was a plan to have a voice_members attribute in the Channel class but this proved to be difficult when it came to actually removing users from the voice channel as the response would return channel_id as null. Fixes #16.
* Handle GUILD_ROLE_UPDATE websocket events.Rapptz2015-10-151-2/+11
|
* Handle GUILD_ROLE_DELETE websocket events.Rapptz2015-10-151-1/+9
|
* Handle GUILD_ROLE_CREATE websocket events.Rapptz2015-10-151-1/+8
|
* Check if the server is valid during GUILD_MEMBER_REMOVE.Rapptz2015-10-151-4/+5
|
* Add Client.change_status.Rapptz2015-10-141-0/+30
|
* Client.send_file now properly closes the file-object.Rapptz2015-10-131-39/+33
|
* Add role colour and hoisting to edit_role.Rapptz2015-10-131-1/+3
|
* Client.send_message can now accept a string ID as the destination.Rapptz2015-10-131-2/+5
|
* Added send_file method.littleyoshi42015-10-111-0/+40
|
* Client.register now takes an invite URL or class.Rapptz2015-10-111-10/+13
|
* edit_profile now returns True or False depending on success.Rapptz2015-10-111-0/+3
|
* Remove get_channel from __getattr__ in Client.Rapptz2015-10-111-2/+1
|
* Use v3 of the Discord API.Rapptz2015-10-111-1/+1
|
* Make event based handlers first classHornwitser2015-10-061-33/+1
| | | | | | Change Client.event decorator to assign the event handler function to the instance it self and levarage dispatch to handle calling these event. Remove old _invoke_event method.
* Change behaviour of on_errorHornwitser2015-10-061-3/+2
| | | | | | | | | 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.
* Add client register APIHornwitser2015-10-061-0/+37
| | | | | | | When clicking on an invite link without having a Discord account it's possible to create an unclaimed account for joining the conversation quickly. Add register() method to Client that performs and invite based registration of an unclaimed account.
* Reconnect when WebSocket diesHornwitser2015-10-061-0/+15
| | | | | Check if the WebSocket connection was supposed to terminate and reconnect to the gateway if this is not the case.
* Make dispatch multithreading safeHornwitser2015-10-061-12/+14
| | | | | | | | | | Guard the execution of dispatch with a recursive thread lock. This is needed to make a thread safe way to send events to Client objects. Note that the only thread safe method is dispatch, everything else is unsafe to call from another thread, as the thead handling the Client object could be modifying arbitrary structures at any time. In addition this only keeps nasal demons away, and does not solve any of the difficult syncronization issues that might be present.
* Move socket and connection state out of ClientHornwitser2015-10-061-215/+278
| | | | | | | | | | 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.
* Add new event systemHornwitser2015-10-061-16/+34
| | | | | | | | | | | | | | | | Add event system based on a public dispatch method in Client. The new event system bases itself on two types of events, internal event handlers and user defined event handlers. Internal event handlers begin with 'handle_', and user defined events begin with 'on_'. Events are dispatched with dispatch(event_name, *args). The Client class should be subclassed and the on_<event> handlers defined in it for responding to events. The handle_<event> handlers can the overridden to override the behaviour of the Client class, though this is not recommended. The subclassing method allows separation of the instance of the client and the code that handles it. (i.e. you don't need the instance of the client object to define event handlers for it). Though, the old method of using the event decorator from the instance will still be supported.
* Fix bug with mentions not working.v0.6.3Rapptz2015-10-021-1/+1
|
* Check for 2xx range instead of specific status codes.Rapptz2015-10-021-20/+25
|
* Fix server attribute not being set in GUILD_MEMBER_ADD.v0.6.2Rapptz2015-10-021-1/+1
|
* Fix another logging errorRapptz2015-10-021-1/+1
|
* Fix an error with logging in the login method.v0.6.1Rapptz2015-09-271-1/+1
|
* Refactor websocket creation to its own function.Rapptz2015-09-251-34/+36
|
* Add edit_channel.Rapptz2015-09-251-0/+31
|
* Listen to CHANNEL_UPDATE events and add on_channel_updateRapptz2015-09-251-0/+8
|
* Move permission overwrite construction to the Channel constructor.Rapptz2015-09-251-27/+0
|
* PRESENCE_UPDATE now updates the user as well.Rapptz2015-09-251-1/+6
| | | | | This means that it calls on_member_update just like the GUILD_MEMBER_UPDATE event in an effort to keep some backwards compat.
* Most functions should now return something more meaningful.Rapptz2015-09-241-4/+21
| | | | | Basically a lot of the request functions now return a booleean indicating if the request was successful or not.