$kick
Kicks a specified user from the server.
Usage:
$kick[userID;reason(optional)]
- userID: The ID of the user to kick. You can use functions like
$findMember
to get the user ID. - reason: (Optional) The reason for the kick. This will be displayed in the audit log.
Examples:
Successfully kicking a user:
This example demonstrates kicking a user named "Unknown User" for "Spamming". $findMember
retrieves the user's ID.
Unsuccessful kick attempt:
Read Below whyThis example shows a failed attempt to kick the server owner (identified by $ownerID
). The bot reports an error because it lacks sufficient permissions. The reason for this is outlined below. The 10
after the reason is ignored as there are only 2 possible arguments
Why can't the bot kick a member?
The most common reason a bot fails to kick a member is due to role hierarchy. Discord prevents members (including bots) from kicking users with roles higher than their highest role. Ensure the bot's role is positioned above the role of the user you're trying to kick.
Important Security Considerations!
Granting kick permissions via custom commands should be done with extreme caution! Any member able to execute the command containing this function will be able to kick any user below the bot's highest role.
Recommendation: Avoid placing the bot's role higher than roles like "Admin" or "Head Moderator" to minimize potential abuse.
Related Functions