1
0
mirror of https://github.com/Rapptz/discord.py.git synced 2025-05-12 16:59:50 +00:00

Attempt to fix compressed READY to work in both Python2 and Python3.

This commit is contained in:
Rapptz 2016-01-13 19:25:59 -05:00
parent cc37672cbf
commit b60c71ab2e

@ -103,9 +103,14 @@ class WebSocket(WebSocketBaseClient):
self.dispatch('socket_raw_receive', msg)
if msg.is_binary:
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))
self.dispatch('socket_response', response)