Repository navigation
Expand file tree
/
Copy pathbot.js
More file actions
60 lines (49 loc) · 1.53 KB
/
Copy pathbot.js
File metadata and controls
60 lines (49 loc) · 1.53 KB
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
//API Info: http://discordjs.readthedocs.io/en/latest/index.html
var Discord = require("discord.js");
var bot = new Discord.Client();
bot.on("presence", (user1, user2) => {
if(user2.game === null) {
bot.moveMember(user2, '187325424743743490');
}
else if(user2.game.name === 'Overwatch') {
bot.moveMember(user2, '190277585039654913');
}
else if(user2.game.name === 'League of Legends') {
bot.moveMember(user2, '190277560695783424');
}
});
bot.on("message", (m) => {
if (m.content === "oh shit") {
bot.sendMessage(m.channel, "waddup");
bot.joinVoiceChannel(m.author.voiceChannel).catch(error);
}
if(m.content === "waddup")
{
var connection = bot.internal.voiceConnection;
connection.playFile("http://michaelgschoen.com/realclassic.wav", 0.5);
bot.on("end", (m) => {
bot.internal.leaveVoiceChannel();
});
}
if (m.content.startsWith("$$$ leave")) {
// Leave the voice channel
bot.internal.leaveVoiceChannel();
// Return to prevent further commands
return;
}
if (m.content.startsWith("$$$ stop")) {
// If the voice connection exists (i.e. the bot is connected to a voice
// channel) ...
if (bot.internal.voiceConnection) {
// ... stop the current playback
bot.internal.voiceConnection.stopPlaying();
}
// Return to prevent execution of further commands
return;
}
});
bot.loginWithToken('MTkxNzQwNTY5MzQzNjIzMTY4.Cj-r0g.we0RnMxlRwi2e-Pdi4K6ENTEosU');
function error(e) {
console.log(e.stack);
process.exit(0);
}