Skip to content

Commit

Permalink
oops, forgot some things
Browse files Browse the repository at this point in the history
  • Loading branch information
williamkray committed Oct 10, 2024
1 parent d692b18 commit bc5fb70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions base-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion community/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:
helper.copy("censor_wordlist")
helper.copy("censor_files")
helper.copy("banlists")
helper.copy("proactive_banning")


class CommunityBot(Plugin):
Expand Down Expand Up @@ -177,7 +178,7 @@ async def check_if_banned(self, userid):
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
Expand Down Expand Up @@ -237,6 +238,9 @@ async def get_banlist_roomids(self):

@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:
Expand Down

0 comments on commit bc5fb70

Please sign in to comment.