skip "cannot invite user that is joined"

This commit is contained in:
Cadence Ember
2026-01-10 13:19:16 +13:00
parent 505c41a35e
commit 3d3671e05a
5 changed files with 18 additions and 42 deletions

View File

@@ -79,9 +79,17 @@ async function joinRoom(roomIDOrAlias, mxid, via) {
}
async function inviteToRoom(roomID, mxidToInvite, mxid) {
await mreq.mreq("POST", path(`/client/v3/rooms/${roomID}/invite`, mxid), {
user_id: mxidToInvite
})
try {
await mreq.mreq("POST", path(`/client/v3/rooms/${roomID}/invite`, mxid), {
user_id: mxidToInvite
})
} catch (e) {
if (e.message.includes("is already in the room.") || e.message.includes("cannot invite user that is joined")) {
// Sweet!
} else {
throw e
}
}
}
async function leaveRoom(roomID, mxid) {