Skip to content

Commit 1f4bdcc

Browse files
feat: category filtering in Viraj cog
1 parent c8bd2cf commit 1f4bdcc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

bmt_discord_bot/cogs/viraj.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
r"\b(\w*)(ise|isation|isations|ising|ised|ises|iser|isers)\b",
77
re.IGNORECASE,
88
)
9+
IGNORED_CATEGORY_IDS = [1031955833371758754]
910

1011

1112
class Viraj(commands.Cog):
1213
"""For correcting Viraj."""
1314

1415
def __init__(self, bot):
1516
self.bot = bot
16-
17+
1718
def cog_check(self, ctx):
1819
return ctx.guild.id == 786701065856221205
1920

@@ -25,7 +26,9 @@ def _correct_text(self, match):
2526
async def on_message(self, message):
2627
if message.author.bot:
2728
return
28-
if "proctor" in message.content.casefold() and random.random() < 0.05:
29+
if message.channel.category_id in IGNORED_CATEGORY_IDS:
30+
return
31+
if "proctor" in message.content.casefold() and random.random() < 0.05:
2932
await message.channel.send("*invigilator")
3033
for match in PATTERN.finditer(message.content):
3134
await message.channel.send(self._correct_text(match))

0 commit comments

Comments
 (0)