-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
87 lines (87 loc) · 2.3 KB
/
bot.js
File metadata and controls
87 lines (87 loc) · 2.3 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var Discord = require('discord.io');
var logger = require('winston');
//var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
token: process.env.BOT_TOKEN,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
// Our bot needs to know if it will execute a command
// It will listen for messages that will start with `!`
var ran = Math.floor(Math.random() * 6);
message = message.toLowerCase();
if (message.includes("?")) {
bot.sendMessage({
to: channelID,
message: 'Any other excellent questions'
});
}
if(message.includes("pumping lemma")){
bot.sendMessage({
to: channelID,
message: 'DRINK!'
});
}
if(message.includes("mission failed")){
bot.uploadFile({
to: channelID,
file: "mission.mp3"
});
}
if(message.includes("study guide")){
bot.uploadFile({
to: channelID,
file: "2019-05-15_12-39.pdf"
});
}
if(message.includes("motivation")) {
if(ran == 0){
bot.uploadFile({
to: channelID,
file: "positive.png"
});
}
else if(ran == 1){
bot.uploadFile({
to: channelID,
file: "positive2.jpg"
});
}
else if(ran == 2){
bot.uploadFile({
to: channelID,
file: "positive3.jpg"
});
}
else if(ran == 3){
bot.uploadFile({
to: channelID,
file: "positive4.jpg"
});
}
else if(ran == 4){
bot.uploadFile({
to: channelID,
file: "positive5.png"
});
}
else if(ran == 5){
bot.uploadFile({
to: channelID,
file: "positive6.jpg"
});
}
}
});