Skip to content

Commit

Permalink
fix bug in clear command
Browse files Browse the repository at this point in the history
user could crash bot when typing amount of messages to delete > 100
  • Loading branch information
PAW122 committed Dec 24, 2024
1 parent aeed0c5 commit 5a07d99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commands/moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ async function execute(interaction, client) {
const user_id = interaction.user.id
const to_delete = interaction.options.getNumber('amount');

if(to_delete > 100 || to_delete < 1) {
return await interaction.reply({
content: `You can delete only 1-100 messages`,
ephemeral: true
})
}

//check for cooldowns
if (!cooldowns.isEnd(`${guild}.${user_id}.clear`)) {
return interaction.reply({
Expand Down

0 comments on commit 5a07d99

Please sign in to comment.