mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 00:04:48 +02:00
userPermissions and clientPermissions are in commando now
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user