Moderation
Clear

The clear command allows users with appropriate permissions to clear messages from a channel in your Discord guild.

Command Usage

To clear messages from a channel, use the following command:

/clear [amount]
  • [amount] (optional): The number of messages to clear. Defaults to 100 if not specified.

Permissions

  • Required Permissions: Manage Messages (requires permission to delete messages in the channel).

Command Behavior

  • Upon executing the command, the bot attempts to clear the specified number of messages from the current channel.
  • It checks for the user's permissions and validates the input (amount) to ensure it's within valid ranges.
  • If successful, it deletes the messages and provides feedback on the number of messages cleared.
  • If any errors occur during the execution (e.g., insufficient permissions, channel not found), it displays an error message.

Examples

  1. To clear 50 messages from the channel:
/clear 50
  1. To clear the default amount of 100 messages:
/clear

Notes

  • Use this command responsibly as it permanently deletes messages from the channel.
  • Users must have the necessary permissions (Manage Messages) to use this command effectively.

Use the clear command to manage message cleanup efficiently within your Discord guild.