mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
Add patronOnly Option
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user