From bc5fb7048c9fd469b1b1f9757e7ea6113befdb76 Mon Sep 17 00:00:00 2001 From: William Kray Date: Thu, 10 Oct 2024 09:43:50 -0700 Subject: [PATCH] oops, forgot some things --- base-config.yaml | 6 ++++++ community/bot.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/base-config.yaml b/base-config.yaml index f538c17..825980c 100644 --- a/base-config.yaml +++ b/base-config.yaml @@ -89,3 +89,9 @@ censor_wordlist: # your bot MUST be in the banlist room already! banlists: - '#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 diff --git a/community/bot.py b/community/bot.py index 01d6fab..7fa130d 100644 --- a/community/bot.py +++ b/community/bot.py @@ -41,6 +41,7 @@ class Config(BaseProxyConfig): helper.copy("censor_wordlist") helper.copy("censor_files") helper.copy("banlists") + helper.copy("proactive_banning") class CommunityBot(Plugin): @@ -177,7 +178,7 @@ class CommunityBot(Plugin): else: pass 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 # if we haven't exited by now, we must not be banned! return is_banned @@ -237,6 +238,9 @@ class CommunityBot(Plugin): @event.on(BAN_STATE_EVENT) async def check_ban_event(self, evt:StateEvent) -> None: + if not self.config["proactive_banning"]: + return + banlist_roomids = await self.get_banlist_roomids() # we only care about ban events in rooms in the banlist if evt.room_id not in banlist_roomids: