Handle GUILD_ROLE_CREATE websocket events.
This commit is contained in:
parent
4ec052a35c
commit
9235a34916
@ -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
|
||||
|
@ -160,6 +160,13 @@ to handle it, which defaults to log a traceback and ignore the exception.
|
||||
|
||||
:param server: The :class:`Server` that got created or deleted.
|
||||
|
||||
.. function:: on_server_role_create(server, role)
|
||||
|
||||
Called when a :class:`Server` creates a new :class:`Role`.
|
||||
|
||||
:param server: The :class:`Server` that was created.
|
||||
:param role: The :class:`Role` that was created.
|
||||
|
||||
|
||||
Utility Functions
|
||||
-----------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user