[Python] Assistance for detecting when discord automod is activated (discord.py)

Discussão em 'Python' iniciado por Stack, Maio 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have a automod setup on my discord server. I want to expand the automod on the discord, and I setup my bot to detected, yet I cannot find any sort of documentation. Or anything to detect the automod


    import discord
    from discord.ext import commands
    from discord import app_commands

    intents = discord.Intents.all()
    bot = commands.Bot(command_prefix=".", intents=intents)

    @bot.event
    async def on_ready():
    print(f"Logged in as {bot.user.name} ({bot.user.id})")


    @bot.event
    async def on_automod_action_execution(action: discord.AutoModAction):
    try:
    print("AutoMod Action Executed")
    print(f"Rule ID: {action.rule_id}")
    print(f"User ID: {action.user_id}")
    print(f"Matched Content: {action.matched_content}")
    print(f"Matched Keyword: {action.matched_keyword}")
    print(f"Content: {action.content}")
    except Exception as e:
    print(f"Failed to handle AutoMod event: {e}")


    Is my code

    I have attempted to use on_automod_action_execution, I have checked the discord.py documentation https://discordpy.readthedocs.io/en/stable/ and do not find a way to detect when its triggered

    Continue reading...

Compartilhe esta Página