cmd.user.unban
Removes a ban from a user in the guild.
JavaScript
const { cmd } = require("syntx.js");
await cmd.user.unban({ user, reason }, message);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user | string | Yes | The ID of the banned user to unban. |
reason | string | No | Audit log reason for the unban. |
message | discord.js Message | Interaction | Yes | A guild message or interaction, used to access the guild. |
Returns
This function does not return a value.
Example
JavaScript
client.command({
name: "unban",
content: async (message) => {
const id = cmd.message.argument(1, message);
if (!id) return message.reply("Please provide a user ID.");
await cmd.user.unban({ user: id, reason: "Appeal accepted" }, message);
message.reply(`User ${id} has been unbanned.`);
},
});Warning
The bot must have the Ban Members permission. If the user is not currently banned in the guild, a SyntxError is thrown.