Browse Source

on_socket_response now handles non-op 0 websocket messages.

pull/24/head
Rapptz 10 years ago
parent
commit
1080941e5e
  1. 13
      discord/client.py

13
discord/client.py

@ -101,13 +101,16 @@ class WebSocket(WebSocketBaseClient):
self.dispatch('socket_raw_receive', msg)
response = json.loads(str(msg))
log.debug('WebSocket Event: {}'.format(response))
if response.get('op') != 0:
log.info("Unhandled op {}".format(response.get('op')))
self.dispatch('socket_response', response)
op = response.get('op')
data = response.get('d')
if op != 0:
log.info("Unhandled op {}".format(op))
return # What about op 7?
self.dispatch('socket_response', response)
event = response.get('t')
data = response.get('d')
if event == 'READY':
interval = data['heartbeat_interval'] / 1000.0
@ -120,7 +123,7 @@ class WebSocket(WebSocketBaseClient):
'CHANNEL_DELETE', 'CHANNEL_UPDATE', 'CHANNEL_CREATE',
'GUILD_MEMBER_ADD', 'GUILD_MEMBER_REMOVE',
'GUILD_MEMBER_UPDATE', 'GUILD_CREATE', 'GUILD_DELETE',
'GUILD_ROLE_CREATE', 'GUILD_ROLE_DELETE',
'GUILD_ROLE_CREATE', 'GUILD_ROLE_DELETE',
'GUILD_ROLE_UPDATE', 'VOICE_STATE_UPDATE'):
self.dispatch('socket_update', event, data)

Loading…
Cancel
Save