-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.js
More file actions
38 lines (34 loc) · 1.16 KB
/
command.js
File metadata and controls
38 lines (34 loc) · 1.16 KB
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
class Command{
constructor(obj)
{
if (!obj.name)
throw Error("Must define a command name.");
if(!obj.description)
throw Error("Must define command description.");
this.name = obj.name;
this.ownerOnly = obj.ownerOnly;
this.group = obj.group ? obj.group : "all";
this.triggers = obj.triggers ? obj.triggers : new Array();
this.description = obj.description;
this.example = obj.example ? obj.example : "";
this.reqUser = obj.reqUser;
this.reqArgs = obj.reqArgs;
this.guildOnly = obj.guildOnly;
this.reqUserPerms = obj.reqUserPerms ? obj.reqUserPerms : new Array();
this.reqBotPerms = obj.reqBotPerms ? obj.reqBotPerms : new Array();
}
run() {
console.log("default command");
}
areYou(cmd){
if(cmd.trim().toLowerCase() == this.name.toLowerCase())
return true;
var found = false;
this.triggers.forEach(trigger => {
if (cmd.trim().toLowerCase() == trigger.trim().toLowerCase())
found = true;
});
return found
}
}
module.exports = Command;