mirror of https://gitlab.com/litecord/litecord.git
storage: better fix for message.webhook_id
the old fix only works for the return value in message create, where as it should be in Storage.get_message instead so that the bug doesn't happen to the other routes
This commit is contained in:
parent
67ae2385b5
commit
7b4aaabcbf
|
|
@ -408,9 +408,6 @@ async def _create_message(channel_id):
|
||||||
await _dm_pre_dispatch(channel_id, user_id)
|
await _dm_pre_dispatch(channel_id, user_id)
|
||||||
await _dm_pre_dispatch(channel_id, guild_id)
|
await _dm_pre_dispatch(channel_id, guild_id)
|
||||||
|
|
||||||
if payload['webhook_id'] == None:
|
|
||||||
payload.pop('webhook_id', None)
|
|
||||||
|
|
||||||
await app.dispatcher.dispatch('channel', channel_id,
|
await app.dispatcher.dispatch('channel', channel_id,
|
||||||
'MESSAGE_CREATE', payload)
|
'MESSAGE_CREATE', payload)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -763,12 +763,13 @@ class Storage:
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
async def _inject_author(self, res):
|
async def _inject_author(self, res: dict):
|
||||||
"""Inject a pseudo-user object when the message is made by a webhook."""
|
"""Inject a pseudo-user object when the message is made by a webhook."""
|
||||||
author_id, webhook_id = res['author_id'], res['webhook_id']
|
author_id, webhook_id = res['author_id'], res['webhook_id']
|
||||||
|
|
||||||
if author_id is not None:
|
if author_id is not None:
|
||||||
res['author'] = await self.get_user(res['author_id'])
|
res['author'] = await self.get_user(res['author_id'])
|
||||||
|
res.pop('webhook_id')
|
||||||
elif webhook_id is not None:
|
elif webhook_id is not None:
|
||||||
res['author'] = {
|
res['author'] = {
|
||||||
'id': webhook_id,
|
'id': webhook_id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue