Skip to content

Commit

Permalink
Check for Manage Messages when configuring cleancommands
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightnessTM committed Apr 15, 2020
1 parent 083d142 commit 82acd20
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions commands/server admin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ module.exports = {
case "enable":
case "on": {
if (!qServerDB.config.clean_suggestion_command) {
if (!message.guild.me.permissions.has("MANAGE_MESSAGES")) return message.channel.send(`<:${emoji.x}> Auto-cleaning of suggestion commands requires the bot have the **Manage Messages** permission. Please give the bot this permission and try again.`);
qServerDB.config.clean_suggestion_command = true;
await dbModify("Server", {id: message.guild.id}, qServerDB);
return message.channel.send(`<:${emoji.check}> Enabled auto-cleaning of suggestion commands.`);
Expand All @@ -629,6 +630,7 @@ module.exports = {
} else return message.channel.send(`<:${emoji.x}> Auto-cleaning of suggestion commands is already disabled!`);
}
case "toggle":
if (!qServerDB.config.clean_suggestion_command && !message.guild.me.permissions.has("MANAGE_MESSAGES")) return message.channel.send(`<:${emoji.x}> Auto-cleaning of suggestion commands requires the bot have the **Manage Messages** permission. Please give the bot this permission and try again.`)
qServerDB.config.clean_suggestion_command = !qServerDB.config.clean_suggestion_command;
await dbModify("Server", {id: message.guild.id}, qServerDB);
return message.channel.send(`<:${emoji.check}> ${qServerDB.config.clean_suggestion_command ? "Enabled" : "Disabled"} auto-cleaning of suggestion commands.`);
Expand Down

0 comments on commit 82acd20

Please sign in to comment.