channel.messages: update edited_at properly

- storage: give str guild_id on message objects
This commit is contained in:
Luna Mendes 2018-11-19 04:25:15 -03:00
parent 109254323e
commit 4e7dcbeefc
2 changed files with 11 additions and 2 deletions

View File

@ -269,9 +269,18 @@ async def edit_message(channel_id, message_id):
# TODO: update embed
# only set new timestamp upon actual update
if updated:
await app.db.execute("""
UPDATE messages
SET edited_at = (now() at time zone 'utc')
WHERE id = $1
""", message_id)
message = await app.storage.get_message(message_id, user_id)
# only dispatch MESSAGE_UPDATE if we actually had any update to start with
# only dispatch MESSAGE_UPDATE if any update
# actually happened
if updated:
await app.dispatcher.dispatch('channel', channel_id,
'MESSAGE_UPDATE', message)

View File

@ -700,7 +700,7 @@ class Storage:
# only insert when the channel
# is actually from a guild.
if guild_id:
res['guild_id'] = guild_id
res['guild_id'] = str(guild_id)
return res