-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdefault_command_handler.js
More file actions
52 lines (47 loc) · 1.82 KB
/
default_command_handler.js
File metadata and controls
52 lines (47 loc) · 1.82 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const CommandHandler = require('./command_handler');
const Util = require('../util');
module.exports = class DefaultCommands extends CommandHandler {
constructor() {
super('');
super.addBasicCommand(
"source",
"Get the HopsonBot source code (link to GitHub",
"https://github.com/HopsonCommunity/HopsonBot");
/*
super.addCommand(
"8ball",
"Ask the magic 8ball for some wisdom.",
">8ball Will Hopson upload tomorrow?",
eightball
)*/
}
getCommands() {
return new Map([...this.simpleCommands, ...this.commands])
}
};
//8-ball command
const BALL_RESULTS = ["Yes.", "Reply hazy, try again.", "Without a doubt.",
"My sources say no.", "As I see it, yes.", "You may rely on it.",
"Concentrate and ask again.", "Outlook not so good",
"It is decidedly so.", "Better not tell you now.",
"Very doubtful.", "Yes - definitely.", "It is certain.",
"Cannot predict now.", "Most likely.", "Ask again later.",
"My reply is no.", "Outlook good.", "Don't count on it.",
"Are you kidding?", "Probably.", "Yes, in due time.", "Go away.",
"Hopson is more likely to put out a video than that"];
/**
* The 8ball command
* @param {TextMessage} message Raw discord text message
* @param {[String]} args Question to ask the 8ball
*/
function eightball(message, args)
{
// Make sure the field is not empty
if (args[0] === undefined) {
Bot.sendMessage(message.channel, "No question given");
return;
}
// Get result
const RESPONSE_INDEX = Util.getRandomInt(0, BALL_RESULTS.length);
message.channel.send(`🎱 The Magic 8-Ball says: "${BALL_RESULTS[RESPONSE_INDEX]}" 🎱`);
}