Temporarily ban a Discord member and automatically unban them

Updated · 6 min read

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 free

Start free. Pro is $9.99/month.

Before you start

  1. 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.

  2. 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.

  3. Choose softban, tempban or ban

    Use a softban when you need to remove a member and clear their recent messages without keeping them banned. With the default ! prefix, run !softban @TestMember Spam wave. !sban is its alias. Softban needs Ban Members and the same target and role-hierarchy checks as other bans.

    The module asks Discord to delete up to seven days of the member’s messages, then immediately unbans them and records a moderation case. The member can rejoin with a valid invite, so a softban is not a timed exclusion. Use !tempban @TestMember 10m Cooling off when the member must stay banned until the scheduled or manual unban; use !ban @TestMember Serious breach for a ban that staff will lift later with !unban <userId>.

  4. 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.

  5. Check a ban status privately by user ID

    Run /mod banlookup user_id:DiscordUserID to privately check whether a user ID is currently banned. With the default ! prefix, use !banlookup DiscordUserID or its alias !checkban DiscordUserID. It needs Ban Members, the same as /tempban, and it takes only a 17–20 digit user ID, not an @mention.

    The slash reply is ephemeral, so only the moderator who ran it sees it. The prefix reply is sent by DM instead, with a channel notice if that DM fails to deliver. If the user is banned, the reply shows the recorded reason, or a no-reason notice when the ban has none. If the user is not banned, or the ID is not a valid 17–20 digit user ID, the reply says so instead.

    Moderation, including banlookup, is part of the Free tier. Turn on Discord Developer Mode (User Settings > Advanced) so you can right-click a member and copy their user ID instead of typing it by hand.

  6. 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.

What does softban mean in Discord?

Softban bans a member while requesting deletion of up to seven days of recent messages, then immediately unbans them. The member can rejoin with a valid invite.

Should I use softban or tempban?

Use softban to remove recent messages without a lasting ban. Use tempban when the member must remain banned until its expiry or until staff run /unban with their user ID.

How do I check whether someone is banned without posting it in the channel?

Run /mod banlookup user_id:DiscordUserID (or !banlookup/!checkban with the prefix). It needs Ban Members, takes only a user ID, and replies privately: /mod banlookup replies ephemerally, and !banlookup replies by DM. It shows the recorded reason if banned, but never a temp-ban end time, since it reads Discord’s ban list rather than the stored tempban expiry.

Ready to configure your bot?

Start free

Start free. Pro is $9.99/month.

Verified sources

File and line references support the commands, settings and limits described.

  • server/lib/botGenerator.js:2391-2391
  • server/templates/modules/moderation/index.js:60-97
  • server/templates/modules/moderation/index.js:1097-1187