forked from Galactic/galactic-bot
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
const Component = require('./Component.js');
|
|
|
|
class Command extends Component {
|
|
|
|
constructor(manager, opts = {}) {
|
|
if(!opts) return null;
|
|
|
|
super(manager, {
|
|
id: opts.name,
|
|
type: 'command',
|
|
disabled: opts.disabled || false,
|
|
guarded: opts.guarded || false
|
|
});
|
|
|
|
this.manager = manager;
|
|
|
|
this.name = opts.name;
|
|
this.module = opts.module;
|
|
this.aliases = opts.aliases || [];
|
|
|
|
this.description = `C_${opts.name.toUpperCase()}_DESCRIPTION`;
|
|
this.usage = opts.usage || '';
|
|
this.examples = opts.examples || [];
|
|
this.rawExamples = Boolean(opts.rawExamples);
|
|
|
|
this.tags = opts.tags || [];
|
|
|
|
this.restricted = Boolean(opts.restricted);
|
|
this.showUsage = Boolean(opts.showUsage);
|
|
this.guildOnly = Boolean(opts.guildOnly);
|
|
|
|
this.archivable = opts.archivable === undefined ? true : Boolean(opts.archivable);
|
|
this.arguments = opts.arguments || [];
|
|
this.keepQuotes = Boolean(opts.keepQuotes);
|
|
|
|
//Moderation
|
|
this.infractionType = opts.infractionType;
|
|
this.customArguments = opts.customArguments || []; //Arguments that will be attempted to be parsed in the command.
|
|
this.forcedArguments = opts.forcedArguments || {}; //Arguments that will be forcefully added (with defaults) if an "alias" exists.
|
|
|
|
this.clientPermissions = opts.clientPermissions || [];
|
|
this.memberPermissions = opts.memberPermissions || [];
|
|
|
|
this.throttling = opts.throttling || {
|
|
usages: 5,
|
|
duration: 10
|
|
};
|
|
|
|
this._throttles = new Map();
|
|
|
|
}
|
|
|
|
get moduleResolveable() {
|
|
return `${this.module.id}:${this.id}`;
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Command; |