mirror of https://gitlab.com/litecord/litecord.git
Fix bot gateway connection
This commit is contained in:
parent
1497456856
commit
cbc55014a4
|
|
@ -224,7 +224,7 @@ class GatewayWebsocket:
|
||||||
|
|
||||||
if self.state.bot:
|
if self.state.bot:
|
||||||
return [{
|
return [{
|
||||||
'id': row[0],
|
'id': row,
|
||||||
'unavailable': True,
|
'unavailable': True,
|
||||||
} for row in guild_ids]
|
} for row in guild_ids]
|
||||||
|
|
||||||
|
|
@ -373,12 +373,13 @@ class GatewayWebsocket:
|
||||||
log.info('subscribing to {} dms', len(dm_ids))
|
log.info('subscribing to {} dms', len(dm_ids))
|
||||||
await self.ext.dispatcher.sub_many('channel', user_id, dm_ids)
|
await self.ext.dispatcher.sub_many('channel', user_id, dm_ids)
|
||||||
|
|
||||||
# subscribe to all friends
|
if not self.state.bot:
|
||||||
# (their friends will also subscribe back
|
# subscribe to all friends
|
||||||
# when they come online)
|
# (their friends will also subscribe back
|
||||||
friend_ids = await self.user_storage.get_friend_ids(user_id)
|
# when they come online)
|
||||||
log.info('subscribing to {} friends', len(friend_ids))
|
friend_ids = await self.user_storage.get_friend_ids(user_id)
|
||||||
await self.ext.dispatcher.sub_many('friend', user_id, friend_ids)
|
log.info('subscribing to {} friends', len(friend_ids))
|
||||||
|
await self.ext.dispatcher.sub_many('friend', user_id, friend_ids)
|
||||||
|
|
||||||
async def update_status(self, status: dict):
|
async def update_status(self, status: dict):
|
||||||
"""Update the status of the current websocket connection."""
|
"""Update the status of the current websocket connection."""
|
||||||
|
|
@ -891,7 +892,6 @@ class GatewayWebsocket:
|
||||||
log.warning('conn close, state={}, err={}', self.state, err)
|
log.warning('conn close, state={}, err={}', self.state, err)
|
||||||
except WebsocketClose as err:
|
except WebsocketClose as err:
|
||||||
log.warning('ws close, state={} err={}', self.state, err)
|
log.warning('ws close, state={} err={}', self.state, err)
|
||||||
|
|
||||||
await self.ws.close(code=err.code, reason=err.reason)
|
await self.ws.close(code=err.code, reason=err.reason)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.exception('An exception has occoured. state={}', self.state)
|
log.exception('An exception has occoured. state={}', self.state)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue