Bot now leaves from rooms which was left by users
This commit is contained in:
parent
573d8ba289
commit
7bb470664d
|
@ -134,6 +134,7 @@ dist
|
|||
reg.js
|
||||
config.json
|
||||
|
||||
./config.json
|
||||
#Bot data
|
||||
encryption_bot_sled
|
||||
bot.json
|
||||
|
|
12
src/index.js
12
src/index.js
|
@ -22,6 +22,8 @@ import {
|
|||
appendUserPictures,
|
||||
checkForMutualLike,
|
||||
eraseUser,
|
||||
eraseUserLikes,
|
||||
eraseUserMedia,
|
||||
getAmountOfUserPictures,
|
||||
getCurrentUserAction,
|
||||
getUserCurrentlyViewingProfile,
|
||||
|
@ -184,8 +186,14 @@ client.on("room.message", async (roomId, event) => {
|
|||
}
|
||||
});
|
||||
|
||||
client.on("room.leave", async (roomId, event) => {
|
||||
console.log(roomId, event);
|
||||
client.on("room.event", async (roomId, event) => {
|
||||
if (event.type === "m.room.member" && event.content?.membership === "leave") {
|
||||
await eraseUser(roomId);
|
||||
await eraseUserLikes(roomId);
|
||||
await eraseUserMedia(roomId);
|
||||
logInfo(`Bot has left a room with ID ${roomId}`)
|
||||
client.leaveRoom(roomId);
|
||||
}
|
||||
})
|
||||
|
||||
client.on("room.invite", async (roomId, event) => {
|
||||
|
|
Loading…
Reference in New Issue