-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
119 lines (93 loc) · 3.24 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
const Discord = require('discord.js');
const bot = new Discord.Client();
const ytdl = require("ytdl-core");
const token = 'TOKEN';
//Variables
const PREFIX = '!';
var servers = {};
bot.on('ready', () =>{
console.log('Online')
})
bot.on('message', msg=>{
if(msg.content === "Hey cinnamon"){
msg.reply('What do you want?!');
}
if(msg.content === "Do you like kais games?"){
msg.reply('NOOOOOOOOOOOOOOOO!');
}
if(msg.content === "Do you wanna build a snowman?"){
msg.reply('NO! NO SINGING ALOUD! YOU DO IT AGAIN AND ILL BAN YOU!');
}
if(msg.content === "hey cinnamon"){
msg.reply('What do you want?!');
}
if(msg.content === "Hey Cinnamon"){
msg.reply('What do you want?!');
}
if(msg.content === "hey cinnamen"){
msg.reply('What do you want?!');
}
if(msg.content === "Hey cinnamen"){
msg.reply('What do you want?!');
}
})
bot.on('message', message => {
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]) {
case 'play':
function play(connection, message){
var server = servers[message.guild.id];
if(!server.queue[1]){
server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audio"}))}
server.dispatcher.on("finish", function(){
server.queue.shift();
if(server.queue[0]){
play(connection, message);
}else{
server.queue.push(args[1]);
//connection.disconnect();
}
});
}
if(!args[1]){
message.channel.send("Include a link, you dummy!")
return;
}
if(!message.member.voice.channel){
message.channel.send("You have to be in a voice channel, dummy!");
return;
}
if(!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
}
var server = servers[message.guild.id];
server.queue.push(args[1]);
if(!message.member.voice.connection) message.member.voice.channel.join().then(function(connection){
play(connection, message);
})
break;
case 'skip':
var server = servers[message.guild.id];
if(server.dispatcher) server.dispatcher.end();
message.channel.send("Skipped the song!")
break;
case 'stop':
var server = servers[message.guild.id];
if(message.guild.voice.connection){
for(var i = server.queue.length -1; i >= 0; i--){
server.queue.splice(i,1);
}
server.dispatcher.end();
message.channel.send("I see how it is! You don't need me anymore!")
message.member.voice.channel.leave()
console.log('Stopped the queue')
}
if(message.guild.connection) message.guild.voice.connection.disconnect();
break;
case 'help':
message.reply('Commands:\n!play [Link to song] - Plays a song\n!skip - Skips the current song in the queue\n!stop - Stops the whole queue\n\n!play2 [Link to song] - Plays a song\n!skip2 - Skips the current song in the queue\n!stop2 - Stops the whole queue\nHey cheese - Do not use this command!\nHey cinnamon - Do not use this command!\nDo you like kais games? - Do not use this command!\nDo you wanna build a snowman? - Do not use this command!');
break;
}
})
//bot.login(token);
bot.login(process.env.token);