forked from cadence/out-of-your-element
Why did I make it this way??? #13
2 changed files with 13 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ module.exports = {
|
|||
// Send in order
|
||||
for (let i = Math.min(messages.length, latestBridgedMessageIndex)-1; i >= 0; i--) {
|
||||
const message = messages[i]
|
||||
if (message.type === DiscordTypes.MessageType.UserJoin) continue // since join announcements don't become events, it would be a repetition to act on them during backfill
|
||||
|
||||
if (!members.has(message.author.id)) members.set(message.author.id, await client.snow.guild.getGuildMember(guild.id, message.author.id).catch(() => undefined))
|
||||
await module.exports.MESSAGE_CREATE(client, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue