-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
245 lines (214 loc) · 6.18 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
require('./ExtendedMessage');
const { Client, Collection } = require("discord.js");
const Discord = require("discord.js");
const { config } = require("dotenv");
const prefix = require('./prefix.js')
const client = new Client({
disableEveryone: true
})
// Collections
client.commands = new Collection();
client.aliases = new Collection();
config({
path: __dirname + "/.env"
});
// Run the command loader
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.on("ready", () => {
console.log(`${client.user.username} is now online!`);
client.user.setActivity(`${prefix} help ` + "|| " + "dad jokes", { type: "PLAYING" });
})
client.on("message", async message => {
if (message.author.bot) return;
if (!message.guild) return;
let sendt = message.content.toLowerCase();
for(var i = 0; i < search.length; i++)
{
for(j = 0; j < search[i].lang.length; j ++)
{
// console.log("Hade!");
// console.log(search[i].lang.length);
// console.log(search[i]);
// console.log(sendt);
// for(var j = 0; j < search[i].lang.length; j ++)
// {
// let lang = search[i].lang[j];
// if(sendt.startsWith(lang)) // || sendt.endsWith(search[1].lang))
// {
// console.log("WELP");
// message.inlineReply("Huh what the fuck" + "\n");
// }
// }
let word = sendt.replace(search[i].lang[j], ""); // What people sent with out I'm
// word = word.replace(exclamations, "");// på indeks etc
let hi_dad = search[i].dad[j]; // I'm dad reply
let greets = search[i].greeting; // Greeting e.g Hello
let no_i_am = search[i].not; // No in different languages
if(sendt.startsWith(search[i].lang[j])) // || sendt.endsWith(search[1].lang))
{
// console.log(word);
if(sendt === hi_dad)
{
message.inlineReply(no_i_am + ", " + hi_dad + "\n");
return;
}
else
{
message.inlineReply(greets + word + ", " + hi_dad + "\n");
return;
}
/* Making sure arabic is the right way */
// if(search[i].lang === أَنَا)
// {
// message.inlineReply(hi_dad + "," + word + greets + "\n");
// }
}
}
}
if (!sendt.startsWith(prefix)) return;
// If message.member is uncached, cache it.
if (!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let mention = message.mentions.users.first();
// Get the command
let command = client.commands.get(cmd);
var count = 0;
var incr = 0;
if (command)
{
command.run(client, message, args,mention);
}
});
var exclamations = [".", "!", ",", "?"]
client.login(process.env.BOT_TOKEN);
var search = [
{
lang: ["ek is"], // Afrikaans
greeting: "Hallo",
dad: ["ek is pa"],
not: "Nee"
},
// {
// lang: "أَنَا", // Arabic
// greeting: "مرحبا",
// dad: "أَنَا بابا",
// },
{
lang: ["我是"], // Chinese
greeting: "你好",
dad: ["我是爸爸"],
not: "不"
},
{
lang: ["jeg er"], // Danish & Norwegian
greeting: "Hallo",
dad: ["jeg er pappa"],
not: "Nei"
},
{
lang: ["i e trøtt"],
greeting: "heidå",
dad: ["i e pap"],
not: "neeei"
},
{
lang: ["ik ben"], // Dutch
greeting: "Hallo",
dad: ["ik ben papa"],
not: "Nee"
},
{
lang: ["mi estas"], // Esperanto
greeting: "Saluton",
dad: ["mi estas paĉjo"],
not: "Ne"
},
{
lang: ["i am", "i'm", "i’m"], // English
greeting: "Hello",
dad: ["i am dad", "i'm dad", "i’m dad"],
not: "No"
},
// {
// lang: "i'm", // English
// greeting: "Hi",
// dad: "i'm dad",
// not: "No"
// },
// {
// lang: "i’m", // English
// greeting: "Hi",
// dad: "i’m dad",
// not: "No"
// },
{
lang: ["je suis"], // French
greeting: "Salut",
dad: "je suis papa",
not: "Non"
},
{
lang: ["ich bin"], // German
greeting: "Hallo",
dad: ["ich bin papa"],
not: "Nein"
},
{
lang: ["eia au"], // Hawaiian
greeting: "Aloha",
dad: ["ʻo wau ka makuakāne"],
not: "Aʻole",
},
{
lang: ["ég er"], // Iclandic
greeting: "Halló",
dad: "ég er pabbi",
not: "Nei"
},
{
lang: ["eg er","æ e","æg e", "eg e"], // Norwegian
greeting: "Hei",
dad: ["eg er pappa", "æ e pappa", "æg e pappa", "eg e pappa"],
not: "Nei"
},
{
lang: ["jestem"], // Polish
greeting: "Cześć",
dad: ["jestem tatą"],
not: "Nie"
},
{
lang: ["aniga"], // Somali
greeting: "As-Salam Alaykum",
dad: ["aniga waxaan ahay aabo"],
not: "Maya"
},
{
lang: ["yo soy", "estoy"], //Spanish
greeting: "Hola",
dad: ["yo soy papa", "estoy papa"],
not: "No"
},
{
lang: ["jag är"], // Swedish
greeting: "Hallo",
dad: ["jag är pappa"],
not: "Nej"
},
{
lang: ["watashi"],
greeting: "Kon'nichiwa",
dad: ["watashi wa otousan desu"],
not: "Nai"
}
/* LAME THING */
// {
// lang: "i'm dad", // dad thing,
// greeting: "No",
// dad: "i'm dad"
// }
];