Automating Discord Moderation with n8n: Ban, Kick, Timeout and AI Detection
By Clément Lacaille (Tech-Bharat) · Published 20 September 2026 · 6 min read · how we build and test
Complete FlowKit Bundle — €269
12 ready-to-import n8n workflows, setup guide in French, 14-day guarantee
A Discord server that grows from a few dozen members to several thousand changes in nature: toxic messages, scam-link spam and raids of fake accounts stop being isolated incidents a volunteer moderator handles one at a time, and become a constant stream. Until recently, automating the response in n8n meant working around the native Discord node — raw HTTP Request calls to the API, or a third-party community node — for any actual sanction. That's no longer the case: the official Discord node now exposes, in its Member resource, Ban, Unban, Kick and Timeout actions. This guide builds a workflow that detects problematic messages with an LLM, then applies a sanction proportionate to the severity — without ever letting the AI ban on its own.
What changed in the native Discord node
The Member resource of the Discord node (n8n-nodes-base.discord) used to cover only basic member reading and management. It now adds four moderation operations that can be triggered directly from a workflow, with no external dependency:
- Ban: a permanent ban, with an option to delete the member's recent messages (useful against a mass spam raid).
- Unban: lifts a ban — essential for building an appeals process or a temporary ban.
- Kick: removes the member from the server immediately, without banning them — they can return with a new invite.
- Timeout: a temporary mute, with preset durations up to Discord's maximum (28 days), or an option to lift an active timeout.
Each action accepts a reason (preset or free text), which is automatically recorded in the Discord server's audit log — the same trail a human moderator leaves when acting from the interface. This changes what's architecturally possible: until now, an automated AI triage could at best alert a human or lock a channel; it can now execute part of the sanction itself, provided you choose carefully which part.
Why not automate everything: what the research says about algorithmic moderation
Gorwa, Binns and Katzenbach (2020, Algorithmic content moderation: Technical and political challenges in the automation of platform governance, Big Data & Society — see the study) document a recurring problem with large-scale automated moderation systems: false positives on context, irony or community-specific language remain frequent even with recent models, and their social cost (a person wrongly banned) far outweighs their technical cost to fix. That's why this workflow reserves full automation for the timeout action — reversible, low-visibility, low-stakes — and requires human approval before any ban or kick.
Conversely, the effectiveness of the sanction itself isn't just intuition: Chandrasekharan, Pavalanathan, Srinivasan, Glynn, Eisenstein and Gilbert (2017, You Can't Stay Here: The Efficacy of Reddit's 2015 Ban Examined Through Hate Speech, Proceedings of the ACM on Human-Computer Interaction) show, using the removal of entire Reddit communities, that consistent, systematic enforcement of moderation rules measurably reduces the toxic language of affected users elsewhere on the platform. The right design isn't "no automated sanctions at all," but calibrated automation: fast and consistent on the low-severity signal, supervised on the heavy sanction.
Workflow architecture
Community "Discord Trigger" node (message received on a monitored channel)
→ AI Agent / Text Classifier (category + severity score)
→ Switch (routing by severity)
├─ Low (borderline spam, off-topic) → log only, no action
├─ Medium (toxicity, isolated insult) → Discord Member → Timeout (24h, auto reason)
└─ High (raid, phishing link, hate speech)
→ Discord → Send and Wait (#moderation channel, humans)
├─ Approved → Discord Member → Ban (+ delete messages)
└─ Rejected → log + no action
→ All branches → moderation log (Google Sheets / Supabase)
Step 1 — Listen to server messages
As detailed in our n8n Discord AI bot guide, the native Discord node has no trigger for incoming messages: you need a community trigger node to fire the workflow on every message posted in monitored channels. That choice still holds here — capture at minimum the channel ID, the author ID and the raw message content.
Step 2 — Classify severity with an LLM
The Text Classifier node or an AI Agent with structured output evaluates each message against categories defined in natural language: spam, toxicity, hate speech, suspicious link. For shared links, cross-check this score with the heuristics already detailed in our article on AI-powered phishing detection — a shortened link mass-posted by an account created the day before is a strong signal, regardless of the accompanying text. The output should include a category and a severity level (low/medium/high), never a binary "ban or not" decision: that call belongs to the next Switch node, not to the LLM.
Step 3 — Route by severity and act accordingly
A Switch node routes each message based on its score. The "medium severity" case is the one that benefits most from the new Timeout operation: instead of waiting for a volunteer moderator to spot the insult, the workflow immediately mutes the member for 24 hours, with a preset reason logged in Discord's audit trail. It's reversible, proportionate, and it stays effective around the clock without any human intervention — including at 3am, when no moderator is online.
Step 4 — Never ban without a human in the loop
The "high severity" case (a coordinated raid, a phishing link, hate speech) triggers a Ban, but never directly: the workflow first posts the flagged message and its score to a dedicated moderation channel, using the Send and Wait for a Response node described in our guide on human approval with Wait and Slack — the same principle applies on Discord, with a moderator clicking Approve or Reject straight from the message. Only after approval does the Discord Member node execute the Ban, with the recent-message-deletion option enabled to clean up a spam raid. This approval step also benefits from the native timestamping described in our article on n8n 2.35's audit trail and HITL: every human moderation decision stays dated and traceable with no extra configuration.
Step 5 — Log everything and plan for lifting sanctions
Every action — including messages dismissed without further action — flows into a centralized log (Google Sheets for a small server, Supabase beyond that), on the same principle as our GDPR audit trail with Supabase guide. A second daily Schedule Trigger can re-read this log to identify timeouts that expired naturally (nothing to do, Discord lifts them on its own) and older bans eligible for an appeal process, then trigger the Unban operation after a human review — never automatically.
Pitfalls to avoid
- A bot role with too many permissions. Discord prevents a bot from acting on a member whose role is equal to or higher than its own: grant only Ban Members, Kick Members and Moderate Members, positioned above standard member roles but below human admin roles.
- A severity threshold miscalibrated at launch. Start with a high threshold for bans (few false positives, at the cost of missing some cases) and tighten it progressively once the moderation log has enough data to assess the classifier's real error rate on your community.
- An empty or generic sanction reason. The "reason" field surfaces in Discord's audit log, visible to other moderators, and serves as justification if a decision is disputed: an auto-generated reason (category plus message excerpt) is far more useful than a systematic "rule violation."
- No retention policy for logged messages. Keeping the content of sanctioned messages indefinitely creates a GDPR problem as soon as an EU-based member is involved; see our guide on automatic GDPR data purging to wire a scheduled expiry onto this log.
Going further
This workflow combines three building blocks already documented separately — AI classification, human approval via Send and Wait, audit logging — assembled here around one simple rule: fully automate the reversible, systematically supervise the permanent. For the logging and compliance side, the Compliance & Audit Pack (€149) provides a ready-to-reuse Supabase audit trail base for the moderation log described here, and the Complete FlowKit Bundle (€269) pairs it with the Inbox AI and RAG Assistant packs for anyone who also handles triaging reports received by email or wants to query the moderation history in natural language.
FAQ
Frequently asked questions
Can n8n's Discord node ban a member without a third-party community node?
Yes, since the update to the native Discord node that added Ban, Unban, Kick and Timeout actions to the Member resource. Previously, these actions required a direct HTTP Request node against the Discord API or a community node; they are now available natively, authenticated with the Discord credentials already configured in n8n.
Should AI be allowed to ban automatically without human oversight?
No, not for a ban. A language model gets tripped up by irony, sarcasm or community-specific jargon, and a false positive on a ban is socially costly to repair even after a technical reinstatement. A short, reversible, low-visibility timeout, by contrast, is a good candidate for full automation; bans and kicks should stay behind a human approval step.
Does the bot's role need full administrator permissions?
No, and it shouldn't have them. Discord enforces a strict role hierarchy: a bot can only act on members whose role sits strictly below its own in the server's role list. Granting it Ban Members, Kick Members and Moderate Members — positioned above regular member roles but below human admin roles — is enough; never a generic admin role.
What about deleted messages or banned members for GDPR compliance?
The moderation log is itself personal data (author, message content, reason, decision) and needs a bounded retention policy rather than indefinite accumulation. Our guide on automatic GDPR data purging in n8n details how to wire a scheduled purge onto this kind of log.