AutoModerationActionExecution Event Not Firing
I’m currently building a moderation feature for my Discord bot using Discord.js v14, and I’m running into an issue where the AutoModerationActionExecution event is not firing at all. The goal is simple: whenever someone triggers an AutoMod rule (specifically blocking @everyone or @here mentions), the bot should send a temporary warning in the same channel and log it in another log channel using an embed. I’ve set up the listener like client.on(
Events.AutoModerationActionExecution, async (action) => { ... })
, and this is called inside my mentionGuard(client)
function during the bot’s startup. I’ve included all required intents in both the code and the Developer Portal — especially GuildModeration, which is required for AutoMod — and partials like Channel, Message, and GuildMember. The bot isn't verified, but has admin perms, and everything else (like slash commands, message content events, presence, etc.) works perfectly. The problem is, while I do get the console log saying the listener initialized, nothing ever happens when the AutoMod rule is triggered, no logs, no warning message, not even the console print from the event callback. The AutoMod rule itself works (message gets deleted), and I’ve also tried enabling "Send alert to channel" to see if it changes anything — but still no event is received by the bot. The rule IDs are correct and confirmed, and there are no errors thrown either. I’m trying to figure out whether there’s something I'm missing — like does the AutoMod rule have to send an alert for the event to fire? Are there known limitations or bugs around this event in Discord.js? Or is there something Discord-side that’s blocking this from being emitted to bots?8 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPnode version:
v23.10.0
-# please ping when you reply to me
I have triggered many debugs, in that all i found that the event is not sending to the BOT when the AutoMod is triggered. But i enabled all the Privileged Gateway Intents, but when i search across discord I discovered The GuildModeration intent is NOT listed in the Privileged Gateway Intents??? I think this will only be visible when the BOT is verified. Am I correct?Provide please how you specify your
client
Like const client = new
...
@WhiteHat Hacker-Dark Team MemberI'm using
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent, GuildModeration] })
from discord.js
, and I also wrapped the listener in a separate module that's called inside client.once('ready', ...)
.then look at the documentation for your version and you will see it's there as well: https://discord.js.org/docs/packages/discord.js/14.18.0/GatewayIntentBits:Enum
the bot defaults to the most recent stable version, since that's what you should generally be running
14.18.x -> 14.19.x is also a minor update and shouldn't break anything, so there really isn't much of a reaosn not to update
👍
Finally cleared the Bug now. This bug makes me tension for the past 3 days.