Add patronOnly Option

This commit is contained in:
Dragon Fire
2021-05-18 20:14:25 -04:00
parent 0872c7e4aa
commit 45d38ff5b3
3 changed files with 15 additions and 14 deletions
+12
View File
@@ -1,10 +1,12 @@
const { Command } = require('discord.js-commando');
const { stripIndents } = require('common-tags');
module.exports = class XiaoCommand extends Command {
constructor(client, info) {
if (!info.argsPromptLimit) info.argsPromptLimit = 2;
super(client, info);
this.patronOnly = info.patronOnly || false;
this.argsSingleQuotes = info.argsSingleQuotes || false;
this.throttling = info.unknown ? null : info.throttling || { usages: 2, duration: 5 };
this.uses = 0;
@@ -16,4 +18,14 @@ module.exports = class XiaoCommand extends Command {
reason: 'Code'
});
}
hasPermission(msg) {
if (this.patronOnly && !this.client.patreon.isPatron(msg.author.id)) {
return stripIndents`
The \`${this.name}\` command can only be used by Patrons.
Visit <https://www.patreon.com/xiaodiscord> to sign-up!
`;
}
return true;
}
};