From 81e761d10312e06341207aa38476547090aec34e Mon Sep 17 00:00:00 2001 From: FrozenChen Date: Fri, 21 Jun 2024 20:59:31 -0300 Subject: [PATCH] automod.py: Kick members who trigger the automod Scams rule --- cogs/automod.py | 8 ++++++++ kurisu.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cogs/automod.py b/cogs/automod.py index acdffab02..73a0834ac 100644 --- a/cogs/automod.py +++ b/cogs/automod.py @@ -161,6 +161,14 @@ async def delete_keyword(self, interaction: discord.Interaction, await interaction.response.send_message(f"Deleted keyword {keyword} from {rule.name} automod rule succesfully.", ephemeral=True) + @commands.Cog.listener() + async def on_automod_action(self, action: discord.AutoModAction): + rule = await action.fetch_rule() + if not rule or not action.member: + return + if rule.name == "Scams": + await action.member.kick(reason="Suspicious behavior") + async def setup(bot): await bot.add_cog(AutoMod()) diff --git a/kurisu.py b/kurisu.py index 6740e372c..94ca61e09 100644 --- a/kurisu.py +++ b/kurisu.py @@ -125,7 +125,8 @@ class Kurisu(commands.Bot): def __init__(self, command_prefix, description, commit, branch, pool): - intents = discord.Intents(guilds=True, members=True, messages=True, reactions=True, bans=True, message_content=True) + intents = discord.Intents(guilds=True, members=True, messages=True, reactions=True, bans=True, + message_content=True, auto_moderation_execution=True) allowed_mentions = discord.AllowedMentions(everyone=False, roles=False) super().__init__( command_prefix=commands.when_mentioned_or(*command_prefix),