only proactively ban in rooms with a join event to reduce unnecessary noise and room complexity

This commit is contained in:
William Kray
2024-10-19 08:57:17 -07:00
parent b49fbb534c
commit 6c85e50b1c
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -197,7 +197,7 @@ class CommunityBot(Plugin):
# if we haven't exited by now, we must not be banned! # if we haven't exited by now, we must not be banned!
return is_banned return is_banned
async def ban_this_user(self, user, reason="banned"): async def ban_this_user(self, user, reason="banned", all_rooms=False):
#self.log.debug(f"DEBUG getting list of rooms") #self.log.debug(f"DEBUG getting list of rooms")
roomlist = await self.get_space_roomlist() roomlist = await self.get_space_roomlist()
# don't forget to kick from the space itself # don't forget to kick from the space itself
@@ -214,7 +214,11 @@ class CommunityBot(Plugin):
roomname = roomnamestate['name'] roomname = roomnamestate['name']
# ban user even if they're not in the room! # ban user even if they're not in the room!
#await self.client.get_state_event(room, EventType.ROOM_MEMBER, user) if all_rooms:
pass
else:
await self.client.get_state_event(room, EventType.ROOM_MEMBER, user)
await self.client.ban_user(room, user, reason=reason) await self.client.ban_user(room, user, reason=reason)
if roomname: if roomname:
ban_event_map['ban_list'][user].append(roomname) ban_event_map['ban_list'][user].append(roomname)
+1 -1
View File
@@ -1,6 +1,6 @@
maubot: 0.1.0 maubot: 0.1.0
id: org.jobmachine.communitybot id: org.jobmachine.communitybot
version: 0.1.15 version: 0.1.16
license: MIT license: MIT
modules: modules:
- community - community