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

ParameterTypeRequiredDescription
userstringYesThe ID of the banned user to unban.
reasonstringNoAudit log reason for the unban.
messagediscord.js Message | InteractionYesA 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.