forked from aleochoam/Otto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
84 lines (69 loc) · 2.39 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
require('dotenv').config();
const commando = require ('discord.js-commando');
const bot = new commando.Client({
commandPrefix: 'cucho ',
owner: process.env.OWNER_ID,
});
bot.registry.registerGroups([
['util', 'Leave'],
['tts', 'Speak'],
['management', 'Kick'],
]);
bot.registry.registerCommandsIn(__dirname + '/src/commands')
.registerDefaults();
bot.on('ready', () => {
console.log('Aguacatalo melo!');
});
bot.on('error', (ex) => {
console.error('ERROR ' + ex);
});
bot.on('message', message => {
const username = message.author.username;
const content = message.content;
if(!content.startsWith(bot.commandPrefix)) return;
console.log('Message from: ' + username);
console.log('Content: ' + message.content);
});
// bot.on('voiceStateUpdate', (oldUser, newUser) => {
// if(newUser.user.username == bot.user.username) return;
// const username = newUser.user.username.toLowerCase();
// const vChannel = newUser.voiceChannel;
// if (oldUser.voiceChannel) {
// oldUser.voiceChannel.leave();
// }
// if (vChannel != undefined && oldUser.voiceChannel != vChannel) {
// vChannel.join()
// .then(connection => {
// if (username == 'aleochoam') {
// connection.playFile('media/sura.mp3');
// }
// else if (username == 'eniqk') {
// connection.playFile('media/healing.mp3');
// }
// else if (username == 'segov') {
// connection.playFile('media/sabor.mp3');
// }
// else if (username == 'david') {
// const opciones = ['molly.mp3', 'intro.mp3'];
// connection.playFile('media/' + getRandomItem(opciones));
// }
// else if (username == 'mornin') {
// const opciones = ['ñengo.mp3', 'phoneDown.mp3', 'metralleta.mp3', 'ronco.mp3'];
// connection.playFile('media/' + getRandomItem(opciones));
// }
// else if (username == 'chumbi') {
// connection.playFile('media/chico.mp3');
// }
// else if (username == 'havoc_42') {
// const opciones = ['cena.mp3', 'rko.mp3'];
// connection.playFile('media/' + getRandomItem(opciones));
// }
// else if (username == 'padrinolopez') {
// connection.playFile('media/gay.mp3');
// }
// // vChannel.leave();
// })
// .catch(console.error);
// }
// });
bot.login(process.env.DISCORD_TOKEN);