Files
xiao/structures/Command.js
T
Daniel Odendahl Jr 70dd45af9a DIE EMBEDS
2017-09-28 18:09:06 +00:00

27 lines
726 B
JavaScript

const { Command } = require('discord.js-commando');
class XiaoCommand extends Command {
constructor(client, info) {
super(client, info);
this.ownerOnly = !!info.ownerOnly;
this.nsfw = !!info.nsfw;
this.throttling = info.throttling || {
usages: 1,
duration: 2
};
}
hasPermission(msg) {
const baseCheck = super.hasPermission(msg);
if (!baseCheck || typeof baseCheck === 'string') return baseCheck;
if (this.ownerOnly && !this.client.isOwner(msg.author)) {
return `The \`${this.name}\` command can only be used by the bot owner.`;
}
if (this.nsfw && !msg.channel.nsfw) return `The \`${this.name}\` command can only be used in NSFW channels.`;
return true;
}
}
module.exports = XiaoCommand;