Add check for permissions on prefix command

Now only people with the MANAGE_GUILD permission can edit the prefix of
that specific server.
This commit is contained in:
SileNce5k 2021-03-13 04:30:16 +01:00
parent 3b75fe165d
commit 5b98166a2b
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -1,9 +1,14 @@
const parseMention = require("../util/parseMention");
const setServerPrefix = require("../util/setServerPrefix"); const setServerPrefix = require("../util/setServerPrefix");
module.exports = { module.exports = {
name: 'prefix', name: 'prefix',
description: 'Change the prefix of the bot in this server.', description: 'Change the prefix of the bot in this server.',
execute({ message, client, args, prefix }) { execute({ message, client, args, prefix }) {
if (!message.member.hasPermission('MANAGE_GUILD')) {
message.channel.send("You do not have sufficient permissions(MANAGE_GUILD) to change the prefix of this server")
return;
}
if (!args[0]) { if (!args[0]) {
message.channel.send(`To change the prefix, execute \`${prefix}prefix <newPrefix>\``); message.channel.send(`To change the prefix, execute \`${prefix}prefix <newPrefix>\``);
return; return;