oops, forgot some things

This commit is contained in:
William Kray
2024-10-10 09:43:50 -07:00
parent d692b18dc1
commit bc5fb7048c
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -89,3 +89,9 @@ censor_wordlist:
# your bot MUST be in the banlist room already! # your bot MUST be in the banlist room already!
banlists: banlists:
- '#community-moderation-effort-bl:neko.dev' - '#community-moderation-effort-bl:neko.dev'
# should we ban proactively? this will generate ban events across all rooms every time
# the ban lists have a new policy added, which may be noisy. however, without this enabled,
# an account may join your rooms, THEN get added to the banlist, and you will have to manually
# ban them from your rooms.
proactive_banning: true
+5 -1
View File
@@ -41,6 +41,7 @@ class Config(BaseProxyConfig):
helper.copy("censor_wordlist") helper.copy("censor_wordlist")
helper.copy("censor_files") helper.copy("censor_files")
helper.copy("banlists") helper.copy("banlists")
helper.copy("proactive_banning")
class CommunityBot(Plugin): class CommunityBot(Plugin):
@@ -177,7 +178,7 @@ class CommunityBot(Plugin):
else: else:
pass pass
except Exception as e: except Exception as e:
self.log.debug(f"Found something funny in the banlist {l} for {rule['content']}: {e}") self.log.debug(f"Found something funny in the banlist {list_id} for {rule['content']}: {e}")
pass pass
# 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
@@ -237,6 +238,9 @@ class CommunityBot(Plugin):
@event.on(BAN_STATE_EVENT) @event.on(BAN_STATE_EVENT)
async def check_ban_event(self, evt:StateEvent) -> None: async def check_ban_event(self, evt:StateEvent) -> None:
if not self.config["proactive_banning"]:
return
banlist_roomids = await self.get_banlist_roomids() banlist_roomids = await self.get_banlist_roomids()
# we only care about ban events in rooms in the banlist # we only care about ban events in rooms in the banlist
if evt.room_id not in banlist_roomids: if evt.room_id not in banlist_roomids: