Skip to content

Commit

Permalink
automod.py: Kick members who trigger the automod Scams rule
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenChen committed Jun 22, 2024
1 parent 5791b5f commit 81e761d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cogs/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
3 changes: 2 additions & 1 deletion kurisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 81e761d

Please sign in to comment.