Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Fixed using ?config always returning missing permissions when the use…
Browse files Browse the repository at this point in the history
…r does not have administrator or owner.

- Fixed JSDoc.
  • Loading branch information
Jyguy committed May 12, 2019
1 parent 919e2c2 commit 5f0248e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions commands/util/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @param {import('../../structures/client.js')} Client
* @param {import('discord.js').Message} message
* @param {String[]} args
*/
const obj = {
blacklistmsg: ['misc', 'blacklist'],
cmdnotfound: ['misc', 'togglemsg'],
Expand Down Expand Up @@ -47,6 +42,11 @@ const options = {
welcomemsg: 'Sets the message sent when someone joins the server.'
};

/**
* @param {import('../../structures/client.js')} Client
* @param {import('discord.js').Message} message
* @param {String[]} args
*/
module.exports = async (Client, message, args) => {
const option = args[1] ? args[1].toLowerCase() : null;
if (!option) {
Expand All @@ -65,7 +65,7 @@ module.exports = async (Client, message, args) => {
return message.channel.send(embed);
}
if (!Object.keys(obj).includes(option)) return Client.functions.get('argFix')(Client, message.channel, 1, `That option is not valid. Use \`${Client.prefixes[message.guild.id]}config\` to see all the options.`);
if (!await Client.checkPerms(option, obj[option][1], message.member)) return message.reply(`:x: Sorry, but you do not have the \`${obj[option][0]}.${obj[option][1]}\` permission.`);
if (!await Client.checkPerms(obj[option][1], obj[option][0], message.member)) return Client.functions.get('noCustomPerm')(message, `${obj[option][0]}.${obj[option][1]}`);

const value = args[2] ? args[2].toLowerCase() : null;
if (!value) return Client.functions.get('argMissing')(message.channel, 2, 'a value for the config');
Expand Down

0 comments on commit 5f0248e

Please sign in to comment.