Skip to content

Commit

Permalink
Check for permission on purge
Browse files Browse the repository at this point in the history
  • Loading branch information
Pim112 authored Aug 20, 2024
1 parent edb283b commit 1ea0abd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions commands/purge.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module.exports = {
async execute(interaction) {
const deleteCount = interaction.options.get('num').value;

if (!interaction.member.permissions.has('MANAGE_MESSAGES')) {
return interaction.reply("I can't purge these messages.");
}

if (!deleteCount || deleteCount < 2 || deleteCount > 100) {
return void interaction.reply({
content: `Please provide a number between 2 and 100 for the number of messages to delete`,
Expand Down

0 comments on commit 1ea0abd

Please sign in to comment.