2020-04-08 18:08:46 +02:00
|
|
|
const Component = require('./Component.js');
|
|
|
|
|
|
|
|
class Command extends Component {
|
|
|
|
|
2020-04-09 23:08:28 +02:00
|
|
|
constructor(manager, opts = {}) {
|
2020-04-08 18:08:46 +02:00
|
|
|
if(!opts) return null;
|
|
|
|
|
2020-04-09 23:08:28 +02:00
|
|
|
super(manager, {
|
2020-04-08 18:08:46 +02:00
|
|
|
id: opts.name,
|
|
|
|
type: 'command',
|
|
|
|
disabled: opts.disabled || false,
|
|
|
|
guarded: opts.guarded || false
|
|
|
|
});
|
|
|
|
|
2020-04-09 23:08:28 +02:00
|
|
|
this.manager = manager;
|
2020-04-08 18:08:46 +02:00
|
|
|
|
|
|
|
this.name = opts.name;
|
|
|
|
this.module = opts.module;
|
|
|
|
this.aliases = opts.aliases || [];
|
|
|
|
|
2020-05-08 08:50:54 +02:00
|
|
|
this.description = `C_${opts.name.toUpperCase()}_DESCRIPTION`;
|
2020-05-07 01:26:16 +02:00
|
|
|
this.usage = opts.usage || '';
|
|
|
|
this.examples = opts.examples || [];
|
2020-04-08 18:08:46 +02:00
|
|
|
|
|
|
|
this.restricted = Boolean(opts.restricted);
|
2020-05-07 01:26:16 +02:00
|
|
|
this.showUsage = Boolean(opts.showUsage);
|
2020-04-08 18:08:46 +02:00
|
|
|
this.guildOnly = Boolean(opts.guildOnly);
|
2020-05-07 01:26:16 +02:00
|
|
|
|
2020-05-25 13:13:34 +02:00
|
|
|
this.archivable = opts.archivable === undefined ? true : Boolean(opts.archivable);
|
2020-04-09 23:08:28 +02:00
|
|
|
this.arguments = opts.arguments || [];
|
2020-05-17 15:07:39 +02:00
|
|
|
this.parameterType = opts.parameterType || 'SPLIT'; //SPLIT or PLAIN, PLAIN = string, SPLIT = split into array, includes quotes
|
|
|
|
|
|
|
|
this.grantable = Boolean(opts.grantable);
|
2020-04-08 18:08:46 +02:00
|
|
|
|
|
|
|
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}`;
|
|
|
|
}
|
2020-04-08 16:27:34 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Command;
|