This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
359 lines (291 loc) · 10.3 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
const Discord = require('discord.js');
const { MessageEmbed, MessageAttachment } = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
const fs = require("fs")
const mongoose = require('mongoose');
var ComptePlayEgirl = require('./model/ComptePlayEgirl.js');
var administrateur= process.env.ADMINISTRATEUR || config.administrateur
var userDB = process.env.USERDB || config.UserDB;
var passwordDB = process.env.PASSWORDDB || config.PasswordDB;
var dispatcher = ""
var musiqueList = []
var musiqueEnCours = ""
const url = "mongodb+srv://"+ userDB +":"+ passwordDB +"@cluster0.s8x9g.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
mongoose.connect(url, {
useUnifiedTopology: true,
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: true,
});
//lancé lorsque le bot est ready
client.on("ready", () => {
fs.readdirSync("./musique/").forEach(file => {
musiqueList.push(file);
});
console.log(musiqueList)
client.user.setPresence({
status: 'online',
activity: {
name: 'du Egirl de Pike',
type: 'STREAMING',
url: 'https://www.youtube.com/watch?v=nvYi3XlP8sk'
}
})
play()
});
//methode qui gere les message entré dans le tchat
// client.on('message', async message => {
// //test si message envoyer par un bot
// if(message.author.bot) return;
// });
function play()
{
const channel = client.channels.cache.get(process.env.VOC || config.voc);
if (!channel) return console.error("The channel does not exist!");
channel.join().then(connection => {
musiqueEnCours = musiqueList[parseInt(Math.random() * musiqueList.length)]
dispatcher = connection.play( "./musique/" + musiqueEnCours,{volume: 0.5,});
dispatcher.on('finish', () => {
ajoutPlay()
play()
});
}).catch(e => {
console.error(e);
});
}
//ajouté +1 quand la musique se fini
function ajoutPlay()
{
//Recuperation channel disponible dans la BDD
ComptePlayEgirl.find().exec((erreur, playCount) => {
if (erreur) return console.error(err);
if(playCount.length == 0)
{
const addComptePlayEgirl = new ComptePlayEgirl({
nombrePlay: 1
});
addComptePlayEgirl.save((err) => {
if (err) return console.error(err);
});
}
else
{
var newvalues = {nombrePlay: playCount[0].nombrePlay + 1 };
ComptePlayEgirl.updateOne(playCount[0], newvalues, function(err, res) {
if (err) throw err;
});
}
});
}
//convertir le nombre de seconde en Heure / minute / seconde
function format(time) {
// Hours, minutes and seconds
var hrs = ~~(time / 3600);
var mins = ~~((time % 3600) / 60);
var secs = ~~time % 60;
// Output like "1:01" or "4:03:59" or "123:03:59"
var ret = "";
if (hrs > 0) {
ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
}
ret += "" + mins + ":" + (secs < 10 ? "0" : "");
ret += "" + secs;
return ret;
}
//methode qui gere les message entré dans le tchat
client.on('message', async message => {
//commande qui renvoie des stats sur le bot (nbplay / nbTime)
if(message.content.toLowerCase() == "!statpike")
{
ComptePlayEgirl.find().exec((erreur, playCount) => {
if (erreur) return console.error(err);
if(musiqueEnCours == "pike-e-girl.mp3") //62724 play de egirl de pike avant ajoue autre musique
{
const XpEmbed = new MessageEmbed()
.setColor('#7100fc')
.setTitle("Nombres de Musique joué par Pike'Bot")
.setURL('https://www.youtube.com/watch?v=nvYi3XlP8sk')
.setDescription("**Nb Play: " + playCount[0].nombrePlay + "**")
.addField('Équivalant à **' + format(playCount[0].nombrePlay * 209) + "**", '\u200B', true)
.setTimestamp()
.setFooter('Bot crée par BadbounsTV', 'https://media.discordapp.net/attachments/815030909010444318/822519435268718613/miniLogoRGB.gif');
message.channel.send(XpEmbed)
}
else
{
const XpEmbed = new MessageEmbed()
.setColor('#7100fc')
.setTitle("Nombres de Musique joué par Pike'Bot")
.setURL('https://www.youtube.com/watch?v=ltuAhZH6PmA')
.setDescription("**Nb Play: " + playCount[0].nombrePlay + "**")
.addField('Équivalant à **' + format(playCount[0].nombrePlay * 209) + "**", '\u200B', true)
.setTimestamp()
.setFooter('Bot crée par BadbounsTV', 'https://media.discordapp.net/attachments/815030909010444318/822519435268718613/miniLogoRGB.gif');
message.channel.send(XpEmbed)
}
})
}
//commande qui reload le bot
if(message.content.toLowerCase() == "!reloadpike")
{
if(message.author.id != administrateur)
{
message.channel.send("cette commande est reserver a l'administrateur <@"+administrateur+"> !!")
return;
}
else
{
setTimeout(() => {
play();
}, 1000);
message.member.voice.channel.leave();
message.channel.send("Reload En Cours...")
dispatcher = "";
}
}
//commande qui nous donne les paroles de la musique
if(message.content.toLowerCase() == "!paroleegirl")
{
try {
const embed = new Discord.MessageEmbed()
.setFooter("Pike'Bot",client.user.avatarURL())
.setTitle("Parole Pike Egirl")
.setDescription(`REFRAIN:
Depuis tout petit je sais que j'aime les E-Girls
J'pourrais les regarder pendant des heures
Jusqu'à c'que j'meurs
Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
Je vais lui faire passer l'aspirateur
Pour moi elle fera tout le dur labeur
t'inquiète pas qu'avec moi elle en passera des heures
Yayaya, Hellsey marie-moi
Yayayaya, Hellsey épouse-moi
1ER COUPLET:
Elle a les cheveux bleus et roses
Un peu comme une gomme
Avec elle la vie n'est plus morose
Depuis qu'elle efface mes fautes
Elle ressemble à Belle Delphine mais moi ça me dérange pas
Tu sais j'aime ce genre de filles qui vend son eau de bain
Kenne-Kennedy, tu manques mon amie
On se verra au paradis
Toi moi et Billy
Kenne-Kennedy, tu manques mon amie
Depuis que t'es bannie
Zebi zebi zebi zebi
PONT:
Ooooh Hellsey épouse-moi,
Yayaya,
Ohohohohoh ouais,
Hellsey marie-moi
REFRAIN:
Depuis tout petit je sais que j'aime les E-Girls
J'pourrais les regarder pendant des heures
Jusqu'à c'que j'meurs
Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
Je vais lui faire passer l'aspirateur
Pour moi elle fera tout le dur labeur
t'inquiète pas qu'avec moi elle en passera des heures
Yayaya, Hellsey marie-moi
Yayayaya, Hellsey épouse-moi
2E COUPLET:
J'suis trop accro à toi comme du cannabis
J'aimerais dire des choses mais j'veux pas finir banni
Donc j'vais dire que t'es belle
Et que j'ai envie de m'étouffer entre tes.. (fesses)
Et vu que j'ai la niaque, j'vais aussi t'exploser ton gros fiak
T'es trop fraîche j'ai envie de te manger comme un steak
Tu es ma planète
Sans toi je n'suis plus un mec
PONT:
Ooooh Hellsey épouse-moi,
Yayaya,
Ohohohohoh ouais,
Hellsey marie-moi
REFRAIN:
Depuis tout petit je sais que j'aime les E-Girls
J'pourrais les regarder pendant des heures
Jusqu'à c'que j'meurs
Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
Je vais lui faire passer l'aspirateur
Pour moi elle fera tout le dur labeur
t'inquiète pas qu'avec moi elle en passera des heures
Yayaya, Hellsey marie-moi
Yayayaya, Hellsey épouse-moi
Yayaya, Hellsey marie-moi
Yayayaya, Hellsey épouse-moi`)
message.channel.send(embed)
// message.channel.send(`REFRAIN:
// Depuis tout petit je sais que j'aime les E-Girls
// J'pourrais les regarder pendant des heures
// Jusqu'à c'que j'meurs
// Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
// Je vais lui faire passer l'aspirateur
// Pour moi elle fera tout le dur labeur
// t'inquiète pas qu'avec moi elle en passera des heures
// Yayaya, Hellsey marie-moi
// Yayayaya, Hellsey épouse-moi
// 1ER COUPLET:
// Elle a les cheveux bleus et roses
// Un peu comme une gomme
// Avec elle la vie n'est plus morose
// Depuis qu'elle efface mes fautes
// Elle ressemble à Belle Delphine mais moi ça me dérange pas
// Tu sais j'aime ce genre de filles qui vend son eau de bain
// Kenne-Kennedy, tu manques mon amie
// On se verra au paradis
// Toi moi et Billy
// Kenne-Kennedy, tu manques mon amie
// Depuis que t'es bannie
// Zebi zebi zebi zebi
// PONT:
// Ooooh Hellsey épouse-moi,
// Yayaya,
// Ohohohohoh ouais,
// Hellsey marie-moi`);
// message.channel.send(`
// Parole E girl:
// REFRAIN:
// Depuis tout petit je sais que j'aime les E-Girls
// J'pourrais les regarder pendant des heures
// Jusqu'à c'que j'meurs
// Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
// Je vais lui faire passer l'aspirateur
// Pour moi elle fera tout le dur labeur
// t'inquiète pas qu'avec moi elle en passera des heures
// Yayaya, Hellsey marie-moi
// Yayayaya, Hellsey épouse-moi
// 2E COUPLET:
// J'suis trop accro à toi comme du cannabis
// J'aimerais dire des choses mais j'veux pas finir banni
// Donc j'vais dire que t'es belle
// Et que j'ai envie de m'étouffer entre tes.. (fesses)
// Et vu que j'ai la niaque, j'vais aussi t'exploser ton gros fiak
// T'es trop fraîche j'ai envie de te manger comme un steak
// Tu es ma planète
// Sans toi je n'suis plus un mec
// PONT:
// Ooooh Hellsey épouse-moi,
// Yayaya,
// Ohohohohoh ouais,
// Hellsey marie-moi
// REFRAIN:
// Depuis tout petit je sais que j'aime les E-Girls
// J'pourrais les regarder pendant des heures
// Jusqu'à c'que j'meurs
// Je lui donnerais tout je suis un admirateur (oh oui mon coeur)
// Je vais lui faire passer l'aspirateur
// Pour moi elle fera tout le dur labeur
// t'inquiète pas qu'avec moi elle en passera des heures
// Yayaya, Hellsey marie-moi
// Yayayaya, Hellsey épouse-moi
// Yayaya, Hellsey marie-moi
// Yayayaya, Hellsey épouse-moi`)
} catch (error) {
console.log(error)
}
}
})
//login du bot a discord
client.login(process.env.TOKEN || config.token);