Skip to content

Commit

Permalink
[Fix] Added permission check for deleteMessages command. (Only member…
Browse files Browse the repository at this point in the history
…s with MANAGE_MESSAGES permission flag)
  • Loading branch information
naseif committed Aug 30, 2021
1 parent befa891 commit 468d54b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions commands/admin/deleteMessages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions } = require("discord.js");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
data: new SlashCommandBuilder()
Expand All @@ -11,6 +13,18 @@ module.exports = {
const integer = interaction.options.getInteger("int");
await interaction.deferReply();

if (
!interaction.member.permissions.has([Permissions.FLAGS.MANAGE_MESSAGES])
)
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
`❌ | You do not have permission to delete Messages!`
),
],
});

try {
const getMessages = await interaction.channel.messages.fetch({
limit: 100,
Expand Down

0 comments on commit 468d54b

Please sign in to comment.