mirror of https://gitlab.com/litecord/litecord.git
channel.messages: fix mention affecting user_read_state
This commit is contained in:
parent
66ea960f71
commit
500579e957
|
|
@ -191,13 +191,16 @@ async def create_message(channel_id):
|
||||||
'MESSAGE_CREATE', payload)
|
'MESSAGE_CREATE', payload)
|
||||||
|
|
||||||
if ctype == ChannelType.GUILD_TEXT:
|
if ctype == ChannelType.GUILD_TEXT:
|
||||||
for str_uid in payload['mentions']:
|
for mention in payload['mentions']:
|
||||||
uid = int(str_uid)
|
uid = int(mention['id'])
|
||||||
|
|
||||||
|
print('updating user read state', repr(uid), repr(channel_id))
|
||||||
|
|
||||||
await app.db.execute("""
|
await app.db.execute("""
|
||||||
UPDATE user_read_state
|
UPDATE user_read_state
|
||||||
SET mention_count += 1
|
SET mention_count = mention_count + 1
|
||||||
WHERE user_id = $1 AND channel_id = $2
|
WHERE user_id = $1
|
||||||
|
AND channel_id = $2
|
||||||
""", uid, channel_id)
|
""", uid, channel_id)
|
||||||
|
|
||||||
return jsonify(payload)
|
return jsonify(payload)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue