Template setup walkthrough
Set up moderation commands.
Remove recent messages with a command that checks who is using it. The Moderation commands template gives authorized moderators /clear and replies without deleting anything when an ordinary member tries it.

1. Choose the matching template
Create a workspace and select Moderation commands. Do not rebuild it from an unrelated template. Complete the guided Discord connection, deployment and server invitation; the first-bot guide covers those steps.
2. Make the first edit in the graph
- Inspect the command optionSelect /clear and check that amount is a required integer with a minimum of 1 and maximum of 100. Follow its output into the purge count.
- Trace the permission resultThe permission check examines the person using the command. Its result goes into Condition; true leads to deletion and false leads only to the denial reply.
- Edit replies without moving the gateYou can personalize the success and denial messages. Keep Purge messages behind the true branch, not before the condition.
3. Try it in a test server
Create disposable messages in a test channel. Try /clear as a moderator, then as an ordinary member, and inspect both outcomes.
Example interaction
- Member action
/clear amount: 5- Bot behavior
- Checks the member’s Manage Messages permission, removes eligible recent messages if allowed, then confirms the action.
4. Diagnose the result
| If this happens | What to inspect |
|---|---|
| An ordinary member can delete messages | Stop using the command until the permission check and branch connections are repaired. A command description saying moderators only does not enforce access. |
| A moderator is denied | Check that the test or real member actually has Manage Messages in the channel. |
| The bot cannot delete, or old messages remain | Check the bot’s own Manage Messages permission and message ages. Do not remove the member permission check to work around a bot-permission failure. |
You can rehearse behavior using the simulator walkthrough. Recheck the real server’s permissions after inviting the bot; the simulator uses the world you provide.
5. Change one thing, then retest
Add a moderation log after the successful action, or a stricter role check before it. Preserve the denied branch whenever you edit the flow.
Save and rerun the relevant checks before deploying the edited workflow. Keep a case for the original behavior so a new branch does not accidentally remove it.
This template is a clear command, not a full moderation suite. It does not include bans, timeouts, warning histories or appeal handling. Deletions affect real messages: first test in a disposable channel.