clean
This command deletes a specified amount of messages from a channel. The command can be optionally limited by criteria, such as deleting only messages from bots, as seen in the Options section below.
Due to limitations imposed by Discord, only messages sent within the last 14 days can be deleted.
Required permissions
MoonlightBot requires the following permissions to successfully execute this command:
View Channel
Send Messages
Manage Messages
Read Message History
By default, a user is required to have the following permissions to use this command:
Manage Messages
For more information on editing permission requirements for specific users/roles, refer to the permissions tutorial
Syntax
/clean [amount] [user] [starts-with] [ends-with] [contains] [bots] [system] [preserve-pins] [no-trace]Options
amount: The amount of messages you want to clean (The default/maximum amount is 100)user: Delete messages sent by a specified userstarts-with: Delete messages that start with this valueends-with: Delete messages that end with this valuecontains: Delete messages that contain this valuebots: Whether or not to delete messages sent by bots. If this option is left blank, the bot will not differentiate between messages sent by users and bots. If set to false, the bot will not delete bot messages, but if set to true, the bot will only delete bot messagessystem: Whether or not to delete system messages. System messages are messages sent by Discord, such as join or pin messages. This uses the same syntax as thebotsoptionpreserve-pins: If true, pinned messages will not be deletedno-trace: If true, the confirmation message will only be visible to you
Logs
CHANNEL_CLEAN: MoonlightBot will send a message with two things: an HTML file that contains the history of the deleted messages and an embed detailing where messages were cleaned, how many were cleaned, who cleaned them, and the filters applied

Rather than rendering them like other downloadable files, Discord displays the raw content of HTML files. To download the HTML file, click the download button at the bottom-right of the file display. Double-click the file, and your computer will open a new tab in your browser to display a visualization of the messages deleted.
For more information on setting up those logs, refer to the log setup tutorial
Last updated