Bot now leaves from rooms which was left by users
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -134,6 +134,7 @@ dist
|
|||||||
reg.js
|
reg.js
|
||||||
config.json
|
config.json
|
||||||
|
|
||||||
|
./config.json
|
||||||
#Bot data
|
#Bot data
|
||||||
encryption_bot_sled
|
encryption_bot_sled
|
||||||
bot.json
|
bot.json
|
||||||
|
|||||||
12
src/index.js
12
src/index.js
@@ -22,6 +22,8 @@ import {
|
|||||||
appendUserPictures,
|
appendUserPictures,
|
||||||
checkForMutualLike,
|
checkForMutualLike,
|
||||||
eraseUser,
|
eraseUser,
|
||||||
|
eraseUserLikes,
|
||||||
|
eraseUserMedia,
|
||||||
getAmountOfUserPictures,
|
getAmountOfUserPictures,
|
||||||
getCurrentUserAction,
|
getCurrentUserAction,
|
||||||
getUserCurrentlyViewingProfile,
|
getUserCurrentlyViewingProfile,
|
||||||
@@ -184,8 +186,14 @@ client.on("room.message", async (roomId, event) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on("room.leave", async (roomId, event) => {
|
client.on("room.event", async (roomId, event) => {
|
||||||
console.log(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) => {
|
client.on("room.invite", async (roomId, event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user