/unban
Unban a user who was previously banned from the server. Creates an UNBAN case and marks any prior BAN cases for the user as inactive.
Required Permission
Both the user executing the command and the bot must have the Ban Members permission.
Options
| Option | Required | Description |
|---|---|---|
user_id | Yes | The Discord user ID of the user to unban. Must be a valid Discord snowflake (17-20 digits). |
reason | No | Reason for the unban. Defaults to "No reason provided" if omitted. |
Behavior
- User ID validation -- The bot verifies that the provided value is a valid Discord snowflake (a 17 to 20 digit numeric string).
- Discord unban -- The bot removes the ban through the Discord API.
- User info fetch -- The bot retrieves the unbanned user's profile information (username, avatar) for display in the response and mod log.
- Case creation -- A case record is created with the action type UNBAN, recording the target user, moderator, and reason.
- Previous case deactivation -- Any existing BAN cases for this user in the current server are marked as inactive. This provides a clear audit trail showing that the ban has been lifted.
- Mod log -- If a mod log channel is configured, the bot posts a formatted embed with the unban details.
Why User ID Instead of Mention
The /unban command requires a user ID rather than a user mention (@username) because banned users are no longer members of the server. Discord's mention system only works for users who are currently in the server, so a raw user ID is the only reliable way to identify a banned user.
How to Find a User ID
- Enable Developer Mode in Discord (User Settings > App Settings > Advanced > Developer Mode).
- Right-click on the user's name in the ban list (Server Settings > Bans) or in any message or profile view.
- Select Copy User ID.
Notes
- If the user ID does not correspond to a currently banned user, the command will fail with an error message.
- The deactivation of prior BAN cases is a bookkeeping operation. It does not delete those cases; they remain in the case history with an inactive status, preserving the full moderation record.
- The bot's response to this command is ephemeral - only visible to the moderator who ran it.