galactic-bot/structure/interfaces/Command.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-04-08 18:08:46 +02:00
const Component = require('./Component.js');
class Command extends Component {
constructor(manager, opts = {}) {
2020-04-08 18:08:46 +02:00
if(!opts) return null;
super(manager, {
2020-04-08 18:08:46 +02:00
id: opts.name,
type: 'command',
disabled: opts.disabled || false,
guarded: opts.guarded || false
});
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-05 01:35:01 +02:00
this.description = `C_${opts.name}_DESCRIPTION`;
this.examples = `C_${opts.name}_EXAMPLES`;
this.usage = `C_${opts.name}_USAGE`;
2020-04-08 18:08:46 +02:00
this.restricted = Boolean(opts.restricted);
this.archivable = opts.archivable === undefined ? false : Boolean(opts.archivable);
this.guildOnly = Boolean(opts.guildOnly);
this.arguments = opts.arguments || [];
2020-05-05 01:35:01 +02:00
this.showUsage = Boolean(opts.showUsage);
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;