userPermissions and clientPermissions are in commando now

This commit is contained in:
Daniel Odendahl Jr
2017-09-03 22:26:43 +00:00
parent d50182ea9d
commit 2c12f15e12
2 changed files with 2 additions and 21 deletions
-19
View File
@@ -1,13 +1,10 @@
const { Command } = require('discord.js-commando');
const perms = require('../assets/json/permissions');
class XiaoCommand extends Command {
constructor(client, info) {
super(client, info);
this.ownerOnly = info.ownerOnly;
this.clientPermissions = info.clientPermissions;
this.userPermissions = info.userPermissions;
this.throttling = info.throttling || {
usages: 1,
duration: 2
@@ -18,22 +15,6 @@ class XiaoCommand extends Command {
if (this.ownerOnly && !this.client.isOwner(msg.author)) {
return `The \`${this.name}\` command can only be used by the bot owner.`;
}
if (msg.channel.type === 'text') {
if (this.clientPermissions) {
for (const permission of this.clientPermissions) {
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
return `The \`${this.name}\` command requires me to have the \`${perms[permission]}\` permission.`;
}
}
}
if (this.userPermissions) {
for (const permission of this.userPermissions) {
if (!msg.channel.permissionsFor(msg.author).has(permission)) {
return `The \`${this.name}\` command requires you to have the \`${perms[permission]}\` permission.`;
}
}
}
}
return true;
}
}