Skip to content

Set up AI moderation on a Discord server

This guide sets up moderation that runs on its own. Code checks every message the moment it’s posted, and an AI reads messages in batches for the things a word list can’t catch, like spam and harassment. Every action is logged in a channel you pick.

It takes about ten minutes, most of which is deciding what your rules are.

  • Alfred is in your server. If he isn’t, add the AI Discord bot first.
  • Your Discord account is connected, so he knows the request comes from you. Connect Discord.
  • You’re on a paid plan. Automation is part of Power and up. See Patreon.
  • His role has the permissions the job needs. For moderation that’s View Channel and Read Message History on the channels he watches, Manage Messages to delete, and Moderate Members to time someone out. Add Kick Members or Ban Members only if you want him to use them.
  • His role sits above the roles he moderates. Discord doesn’t let a bot act on a member whose highest role is above its own.

Alfred builds what you describe, so the clearer the rules, the better the result. Work out three things:

  • What gets removed on sight. A list of words or links that are never acceptable. This part runs as plain code with no AI involved.
  • What needs judgement. Spam, harassment, raids, anything where context matters. This is the part an AI reads.
  • What happens each time. Delete only, a warning, a timeout and for how long, and where it’s logged.

Mention him in your server and describe the setup in one message. For example:

@Alfred keep an eye on #general. If a message contains one of these words, delete it and log it in #mod-log: (your list). Otherwise, every 10 messages or 30 seconds, have an AI moderator read the batch. If someone is spamming or harassing another member, time them out for an hour and warn them. Log every action in #mod-log.

He writes the code, tests it, and tells you when it’s saved. If he says it failed to save, that’s a real error in the code he wrote and not a permissions problem.

Two pieces, described in full on Automation:

  • A reflex that runs on every message in the channel. It checks the message against your word list and deletes a match straight away. This is code, so it costs a small sandbox run and is fine to leave running all day.
  • A moderator agent that the reflex wakes with a batch of messages. It reads them together, decides whether anyone broke a rule, and acts. Batching is what keeps the cost down: ten messages become one AI read.

The agent keeps one conversation per channel, so it remembers that a member was warned an hour ago.

Post a message containing one of your banned words from a second account, in the channel he’s watching. It should be deleted, with an entry in your log channel.

Then ask him what happened:

  • “Show me what the moderation reflex has done today.”
  • “Why did you mute that member?”

He can read back the last 50 runs from the past week: what each one decided, which tools it called, and what it cost.

Ask in plain words. He edits the same reflex.

  • “Add these three words to the banned list.”
  • “Only time someone out after two warnings.”
  • “Watch #memes as well, with the same rules.”
  • “Pause moderation in #general.”
  • A message that passes the word check costs almost nothing. The AI read is what uses your allowance, so a larger batch size costs less.
  • Your reflexes together run at most 2,000 times an hour and 20,000 a day. For a very busy channel, tell him to check messages in batches instead of one by one.
  • A reflex that fails ten runs in a row is paused and you’re told. Ask him to resume it once it’s fixed.

Automation can be delayed or paused, so treat it as help for your moderators. Keep a person watching the log channel.

  • He can’t delete or mute. Check the permissions on his role, and that his role is above the member’s highest role.
  • Nothing happens in one channel. Check that he can see that channel. A private channel needs his role added to it.
  • He doesn’t know who you are. Your Discord account isn’t connected yet.
  • Automation for how reflexes work and what they cost.
  • Background Agents for the moderator agent’s memory and settings.
  • Discord for everything else Alfred does in a server.