Update 'Feature: Room State Management'

projectmoon 2020-11-08 20:27:12 +00:00
parent c996eef08f
commit 23f3993bce
1 changed files with 6 additions and 2 deletions

@ -6,9 +6,13 @@ Planning and design of the room state management "feature."
## Bot Changes ## Bot Changes
Listen to Matrix event for when users enter and leave rooms. This is easily accomplished with the `on_room_member` event. When the bot joins a room for the first time, member events are fired for every member in the room. It seems to sync everything, so you will get a join and leave notification many times, potentially. Listen to Matrix event for when users enter and leave rooms. This is easily accomplished with the `on_room_member` event.
The bot does not get membership events from other users when leaving a room. Instead, it will get a member event of leaving the room for itself. In that circumstance, it should delete all user information in the database for the room. * When the bot joins a room for the first time, member events are fired for every member in the room.
* It seems to sync everything, so you will get a join and leave notification many times, potentially. This is problematic for a few reasons.
* **Solution:** The simple solution in the beginning is to ignore any event more than a few seconds old, and then do a full sync of the users in the room when processing the join event. This works until there's a big network slowdown.
If the bot is kicked or banned, it does not get events for users leaving a room. Instead, it will get a member event of leaving the room for itself. In that circumstance, it should delete all user information in the database for the room.
RoomInfo struct is created/updated when the bot joins a room. RoomInfo struct is created/updated when the bot joins a room.