Skip to content

Commit e4a8f9a

Browse files
authored
Added LeadCommands
LeadCommands aren't working right now but the Bot can now recognize if the member is in Leadership or not
1 parent 3b3b3ae commit e4a8f9a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,31 @@ const RoboCommands = (msg) => ({
1111
"ping": () => msg.reply('🏓pong')
1212
});
1313

14+
const LeadCommands = (msg) => ({
15+
"lead": () => msg.reply('👌 You are a Leadership Member')
16+
});
17+
1418
/**
1519
* Handles incoming messages for Robo
1620
*/
1721
const handleMessage = (msg) => {
1822
const PREFIX = 'DG!';
1923
const msgs = msg.content.split(" ")
2024
const roboCommands = RoboCommands(msg);
25+
let role = msg.member.guild.roles.find('name','Leadership')
2126
if (msgs[0] == PREFIX) {
2227
// getting rid of DG! prefix
2328
msgs.splice(0, 1);
2429
if (msgs.length === 0 || msgs == undefined) {
2530
msg.reply('At least one argument is needed to complete a task.');
2631
} else {
27-
if (roboCommands[msgs.join(" ")]) {
28-
roboCommands[msgs.join(" ")]();
32+
if (roboCommands[msgs.join(" ")] || LeadCommands[msgs.join(" ")] ) {
33+
if(role.id === msg.member.guild.roles.find('name','Leadership').id){
34+
roboCommands[msgs.join(" ")]();
35+
LeadCommands[msgs.join(" ")];
36+
}else{
37+
roboCommands[msgs.join(" ")]();
38+
}
2939
} else {
3040
msg.reply('The command you entered is could not be found.')
3141
}

0 commit comments

Comments
 (0)