Remove member repetition bugfixes
This commit is contained in:
@@ -19,7 +19,18 @@ async function removeMember(userID, guildID) {
|
||||
}
|
||||
})()
|
||||
for (const m of membership) {
|
||||
await api.leaveRoom(m.room_id, m.mxid)
|
||||
try {
|
||||
await api.leaveRoom(m.room_id, m.mxid)
|
||||
} catch (e) {
|
||||
if (String(e).includes("not in room")) {
|
||||
// no further action needed
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
// Update cache to say that the member isn't in the room any more
|
||||
// You'd think this would happen automatically when the leave event arrives at Matrix's event dispatcher, but that isn't 100% reliable.
|
||||
db.prepare("DELETE FROM sim_member WHERE room_id = ? AND mxid = ?").run(m.room_id, m.mxid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user