aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-10-14 21:09:31 -0400
committerRapptz <[email protected]>2015-10-15 01:37:54 -0400
commit9235a34916b7909ccff028c1d7ff4b36fb2dfd7a (patch)
tree106570855e910b8444cdda8b3879905d28ebb71b /discord/client.py
parentCheck if the server is valid during GUILD_MEMBER_REMOVE. (diff)
downloaddiscord.py-9235a34916b7909ccff028c1d7ff4b36fb2dfd7a.tar.xz
discord.py-9235a34916b7909ccff028c1d7ff4b36fb2dfd7a.zip
Handle GUILD_ROLE_CREATE websocket events.
Diffstat (limited to 'discord/client.py')
-rw-r--r--discord/client.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py
index 3640b2e7..1b2bf9b8 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -113,7 +113,8 @@ class WebSocket(WebSocketBaseClient):
'MESSAGE_UPDATE', 'PRESENCE_UPDATE', 'USER_UPDATE',
'CHANNEL_DELETE', 'CHANNEL_UPDATE', 'CHANNEL_CREATE',
'GUILD_MEMBER_ADD', 'GUILD_MEMBER_REMOVE',
- 'GUILD_MEMBER_UPDATE', 'GUILD_CREATE', 'GUILD_DELETE'):
+ 'GUILD_MEMBER_UPDATE', 'GUILD_CREATE', 'GUILD_DELETE',
+ 'GUILD_ROLE_CREATE'):
self.dispatch('socket_update', event, data)
else:
@@ -308,6 +309,12 @@ class ConnectionState(object):
self.servers.remove(server)
self.dispatch('server_delete', server)
+ def handle_guild_role_create(self, data):
+ server = self._get_server(data.get('guild_id'))
+ role = Role(**data.get('role', {}))
+ server.roles.append(role)
+ self.dispatch('server_role_create', server, role)
+
def get_channel(self, id):
if id is None:
return None