-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·132 lines (100 loc) · 4.15 KB
/
index.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
var request = require("request");
var counterpick = require("./lolcounterpick");
var probuilds = require("./lolprobuilds");
var cleverIO = require("cleverbot.io");
var cleverBot = new cleverIO("NYFE2sc6MZPNmWad", "6pQ0otrw3a6iugByAaFCb7wp7UBLRYFE"); //https://cleverbot.io/keys
cleverBot.setNick("moscoso");
cleverBot.create(function (err, session) {
// session is your session name, it will either be as you set it previously, or cleverbot.io will generate one for you
// Woo, you initialized cleverbot.io. Insert further code here
var Discordie = require('discordie');
var Events = Discordie.Events;
var client = new Discordie();
const BOTNAME = "Ivern";
const BOT_ID_OUTPUT = "<@280899794799427584>";
client.connect({
token: 'MjgwODk5Nzk0Nzk5NDI3NTg0.C4QnGA.ki15nSSz4eR-EYrFhdIj2DoFOzU'
});
client.Dispatcher.on(Events.GATEWAY_READY, e => {
console.log('Connected as: ' + client.User.username);
});
client.Dispatcher.on(Events.MESSAGE_CREATE, e => {
if (e.message.mentions.length == 1 && e.message.mentions[0].username == BOTNAME) {
/**RANDOM RESPONSE **/
var incomingMessage = e.message.content.replace(BOT_ID_OUTPUT, "").trim().toUpperCase();
cleverBot.ask(incomingMessage, function (err, response) {
//console.log(incomingMessage);
//console.log(err);
//console.log(response); // Will likely be: "Living in a lonely world"
//e.message.channel.sendMessage(response);
});
var commandIssue = false;
var command = incomingMessage.split(" ")[0];
if (command == 'GIFY' || command == "GIPHY") {
console.log(incomingMessage.split(command));
} else if (command == 'HELP' || command == 'COMMAND' || command == 'COMMANDS') {
outgoingMessage = 'Here are the comands I have: \ncounter [championName]\nprobuilds [championName]';
} else if (command == 'COUNTER') {
var champ = incomingMessage.split(" ")[1];
outgoingMessage = champ + " is weak against: " + counterpick.all(champ).join(", ");
console.log(e.message.author + " asked who counters " + champ);
} else if (command == 'PROBUILDS') {
outgoingMessage = probuilds.getBuilds(incomingMessage.split(" ")[1]);
} else if (command == 'PRO' && (incomingMessage.split(" ")[1] == 'BUILD' || incomingMessage.split(" ")[1] == 'BUILDS')) {
outgoingMessage = probuilds.getBuilds(incomingMessage.split(" ")[2]);
} else {
var confused = ["uh ... ?", "wut", "what are you sayin?", "cash me outside how bout dat?", "I'm still dumb af. Tell Goz to upload me some smartz", "beep boop", "404 response not found", "idk... but my favorite color is SPRING ! :D"];
var outgoingMessage = confused[Math.floor(Math.random() * confused.length)];
var greetings = [
"HI", "YO", "HELLO", "WASUP", "WHAT'S UP", "WHAT IS UP", "SUP"
];
for (var x = 0; x < incomingMessage.split(" ").length; x++) {
for (var i = 0; i < greetings.length; i++) {
console.log(incomingMessage.split(" ")[x]);
if (greetings[i] == incomingMessage.split(" ")[x]) {
outgoingMessage = "\'Sup " + e.message.author.username;
break;
}
}
}
if (incomingMessage.includes('PING')) {
outgoingMessage = 'PONG';
}
if (command == 'WHO') {
//'WHO
}
if (incomingMessage.includes('WHO MADE YOU')) {
outgoingMessage = 'The homie Gozillionaire';
console.log(e.message.author + " asked who made me");
}
if (incomingMessage.includes('WHO CODED YOU')) {
outgoingMessage = 'The homie Gozillionaire';
console.log(e.message.author + " asked who made me");
}
if (incomingMessage.includes('WHO PROGRAMMED YOU')) {
outgoingMessage = 'The homie Gozillionaire';
console.log(e.message.author + " asked who made me");
}
//console.log(e.message.channel);
}
e.message.channel.sendMessage(outgoingMessage);
}
});
client.Dispatcher.on(Events.VOICE_CHANNEL_JOIN, e => {
//console.log(e);
});
/*request.post(
'https://discordapp.com/api/channels/280908843167514624/messages', {
json: {
content: 'IM A GOD'
}
},
function (error, response, body) {
if (!error && response.statusCode == 200) {
//console.log(response)
} else {
//console.log("error : " + error);
}
}
);*/
});