-
Notifications
You must be signed in to change notification settings - Fork 0
/
Command.js
40 lines (32 loc) · 1010 Bytes
/
Command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const Discord = require('discord.js');
const Registry = require('./Registry.js');
class Command {
constructor(info, run) {
if (typeof info !== 'object') throw new TypeError('Invalid \'options\' structure.');
if (typeof run !== 'function') throw new TypeError('run must be a function!');
if (!info.name) throw new TypeError('No command name provided.');
if (!info.usage) throw new TypeError('No command usage provided.');
if (!info.description) throw new TypeError('No command description provided.');
this._name = info.name;
this._usage = info.usage;
this._description = info.description;
this._run = run;
this._group = info.group ? info.group : 'gencmds';
}
get name() {
return this._name;
}
get usage() {
return this._usage;
}
get description() {
return this._description;
}
get runMethod() {
return this._run;
}
get group() {
return this._group;
}
}
module.exports = Command;