Fix mention-related KeyError in message callback
This commit is contained in:
parent
3c64b33cb7
commit
4fdf531631
2
TODO.md
2
TODO.md
|
@ -1,7 +1,7 @@
|
|||
# TODO
|
||||
|
||||
- mention color in local echo
|
||||
- cpu usage
|
||||
- room.mentions += 1 key error before registration
|
||||
|
||||
## Main goals for next version
|
||||
|
||||
|
|
|
@ -101,16 +101,17 @@ class NioCallbacks:
|
|||
room_id = room.room_id,
|
||||
)
|
||||
|
||||
if HTML_PROCESSOR.user_id_link_in_html(co, self.client.user_id):
|
||||
rooms = self.client.models[self.client.user_id, "rooms"]
|
||||
rooms[room.room_id].mentions += 1
|
||||
|
||||
mention_list = HTML_PROCESSOR.mentions_in_html(co)
|
||||
|
||||
await self.client.register_nio_event(
|
||||
room, ev, content=co, mentions=mention_list,
|
||||
)
|
||||
|
||||
if HTML_PROCESSOR.user_id_link_in_html(co, self.client.user_id):
|
||||
rooms = self.client.models[self.client.user_id, "rooms"]
|
||||
rooms[room.room_id].mentions += 1
|
||||
|
||||
|
||||
|
||||
async def onRoomMessageNotice(self, room, ev) -> None:
|
||||
await self.onRoomMessageText(room, ev)
|
||||
|
|
Loading…
Reference in New Issue
Block a user