-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot_message.js
163 lines (158 loc) · 4.76 KB
/
bot_message.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
const keywords = require('./keywords');
const help = require('./help');
const redditQuote = require ('./reddit_quote')
const googleSuggest = require ('./google_suggest')
const meme = require ('./meme')
const defineWord = require ('./google-define')
const xkcd = require ('./xkcd')
const version = "yeet";
const roll = (message) => {
let min = 1;
let max = 100;
let roll = Math.floor(Math.random() * (max - min) + 1);
return `${message.author.username} rolled ${roll} (${min}-${max})`
}
let sup = function (message) {
message.channel.send(version)
}
let botMessage = function (command, message, args) {
if (command == 'sup') {
return sup(message)
} else if (command == 'avatar') {
if (!message.mentions.users.size) {
message.channel.send(message.author.displayAvatarURL);
}
const avatarList = message.mentions.users.map(user => {
message.channel.send(user.displayAvatarURL);
});
message.channel.send(avatarList);
} else if (command === "roll") {
message.channel.send(roll(message));
}
else if (command === "gif")
{
let rating = "pg-13";
let query = args.join(' ');
if(message.channel.nsfw)
{
rating = "r";
}
giphyclient.search('gifs', {"q": query, "limit" : 10, "rating" : rating})
.then((response) => {
let responseUrl = response.data[Math.floor(Math.random() * (10 - 1) + 1)].url
message.channel.send(responseUrl);
})
.catch((err) => {
message.channel.send("giphy didn't work....");
})
}
else if (command === "hot-gif")
{
let rating = "pg-13";
giphyclient.trending("gifs", {"rating" : rating})
.then((response) => {
let responseUrl = response.data[Math.floor(Math.random() * (10 - 1) + 1)].url
message.channel.send(responseUrl);
})
.catch((err) => {
console.log(err);
})
}
else if (command === 'trump-quote') {
fetch("https://api.whatdoestrumpthink.com/api/v1/quotes/random")
.then(function(response) {
return response.json();
})
.then(function(trumpJson) {
message.channel.send(trumpJson.message);
});
}
else if (command === 'lukas-quote') {
redditQuote.new().then(function(response) {
message.channel.send(response);
})
}
else if (command === 'opinion') {
let query = args.join(' ');
googleSuggest.new(query).then(function(response) {
if (response) {
message.channel.send(response);
}
})
}
else if (command === 'dank-meme') {
meme.new('dankmemes').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'trump-meme') {
meme.new('presidenttrumptwitter').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'crackhead-cl') {
meme.new('crackheadcraigslist').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'stockphoto') {
meme.new('shittystockphotos').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'bpt-meme') {
meme.new('blackpeopletwitter').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'cursed-img') {
meme.new('cursedimages').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'starterpack') {
meme.new('starterpacks').then(function(meme) {
message.channel.send({embed: meme})
})
}
else if (command === 'got-meme') {
meme.new('freefolk').then(function(meme) {
message.channel.send({embed: meme});
})
}
else if (command === 'rando') {
meme.new('random').then(function(meme) {
message.channel.send({embed: meme})
})
}
else if (command === 'comic') {
message.channel.send({files: ["./comic-.png"]})
}
else if (command === 'help') {
message.channel.send(help.commands());
}
else if (command === 'define') {
word = args[0]
typeOfWord = args[1]
let query = {word: word, typeOfWord: typeOfWord}
defineWord.new(query).then(function(definition){
response = `${query.word}: ${definition}`
message.channel.send(response);
})
}
else if (command === 'xkcd') {
xkcd.new().then(function(response){
message.channel.send({embed: response});
})
}
else if (command === 'new-xkcd') {
xkcd.new(true).then(function(response){
message.channel.send({embed: response});
})
}
}
module.exports = {
new: function(command, message, args) {
botMessage(command, message, args)
}
}