Temporarily ban a Discord member and automatically unban them
To temporarily ban a Discord member, enable the Free Moderation module and run /tempban with a member, duration and optional reason. The command checks Ban Members and Discord role hierarchy, records an expiry and schedules an unban. Treat the expiry as best-effort: if the bot is offline at that time, it unbans after it returns and restores its saved temporary bans.
Start freeStart free. Pro is $9.99/month.
Before you start
- Use an online bot with the Free Moderation module enabled in a server you manage. Test only with a consenting account in a disposable server.
- Give the moderator Ban Members and place the bot role above the test member’s role. Discord hierarchy can prevent a ban even when the moderator has the command permission.
- Choose a duration of at least one minute, such as 10m or 1h. Add a clear optional reason; the module uses its no-reason text when you omit one.
Enable Moderation and check Discord permissions
Open your bot’s Modules tab, enable Moderation for the intended server and save. Use the normal regenerate and start flow if an existing bot needs the module, then wait until it is online.
Before testing, confirm that the moderator has Ban Members and that the bot role is above the test member. The handler also checks whether the target is bannable and whether Discord role hierarchy permits both the moderator and bot to act.
Run one temporary ban with a duration
Run /tempban user:@TestMember duration:10m reason:Cooling off. The member and duration are required; the reason is optional. With a typed prefix, the equivalent shape is !tempban @TestMember 10m Cooling off.
The command requires a duration of at least one minute. It records the expiry with the moderation case, bans the member and replies with the member, duration, moderator, reason and expiration time. The ban request asks Discord to delete up to one day of recent messages.
Verify the scheduled unban
For a disposable-server test, wait for the scheduled expiry, then confirm the member can join again. The module schedules the unban after it records the active temporary-ban case, and it marks that case inactive after its unban attempt.
If the bot restarts, Moderation reloads active temporary-ban cases with expiration times. Expired cases are processed when the bot initializes; future cases are scheduled again. An outage can therefore delay an unban past its displayed expiry, so do not promise an exact second.
Handle an earlier unban or a failed action
If staff need to end the ban early, use /unban user_id:DiscordUserID. That command requires Ban Members and cancels a pending temporary-unban timeout for that member. It expects the user ID, not a mention.
If the tempban fails, recheck Ban Members, target bannability and role order before trying again. Do not substitute softban for a temporary ban: softban bans and immediately unbans to remove recent messages, while tempban keeps the member banned until the scheduled or manual unban.
Frequently asked questions
How do I temporarily ban someone in Discord?
Enable Moderation, then run /tempban with a member, a duration of at least one minute and an optional reason.
Does a Discord tempban automatically unban the member?
Yes. Moderation records an expiry and schedules an unban. If the bot was offline at expiry, it processes saved active tempbans after it starts again, so the unban can be late.
What permissions does tempban need?
The moderator needs Ban Members, and Discord role hierarchy must allow both the moderator and the bot to ban the target.
Can I end a tempban early?
Yes. An authorized moderator can run /unban with the member’s Discord user ID; it also cancels the pending temporary-unban timeout.
Related modules
Related guides
Verified sources
File and line references support the commands, settings and limits described.
- server/lib/botGenerator.js:2692-2696
- server/templates/modules/moderation/index.js:60-70
- server/templates/modules/moderation/index.js:640-688
- server/templates/modules/moderation/index.js:913-955
