mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-13 01:09:50 +00:00
Attempt to fix compressed READY to work in both Python2 and Python3.
This commit is contained in:
parent
cc37672cbf
commit
b60c71ab2e
@ -103,9 +103,14 @@ class WebSocket(WebSocketBaseClient):
|
|||||||
self.dispatch('socket_raw_receive', msg)
|
self.dispatch('socket_raw_receive', msg)
|
||||||
if msg.is_binary:
|
if msg.is_binary:
|
||||||
msg = zlib.decompress(msg.data, 15, 10490000)
|
msg = zlib.decompress(msg.data, 15, 10490000)
|
||||||
msg = msg.decode('utf-8')
|
if sys.version_info[0] == 2:
|
||||||
|
msg = str(msg).decode('utf-8')
|
||||||
|
else:
|
||||||
|
msg = msg.decode('utf-8')
|
||||||
|
response = json.loads(msg)
|
||||||
|
else:
|
||||||
|
response = json.loads(str(msg))
|
||||||
|
|
||||||
response = json.loads(str(msg))
|
|
||||||
log.debug('WebSocket Event: {}'.format(response))
|
log.debug('WebSocket Event: {}'.format(response))
|
||||||
self.dispatch('socket_response', response)
|
self.dispatch('socket_response', response)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user