Fixed memory leaks

This commit is contained in:
hydrabolt
2015-11-08 10:09:49 +00:00
parent 99a63db142
commit 04c3dbedac
7 changed files with 121 additions and 113 deletions

View File

@@ -7,38 +7,25 @@ client.on("message", m => {
if(m.content === "&init"){
for(var channel of m.channel.server.channels){
if(channel instanceof Discord.VoiceChannel){
client.joinVoiceChannel(channel).catch(error)
.then(connection => {
connection.playFile("C:/users/amish/desktop/Developers.mp3");
});
client.joinVoiceChannel(channel).catch(error);
break;
}
}
}
if(m.content.startsWith("$$$ stop")){
for(var channel of m.channel.server.channels){
if(channel instanceof Discord.VoiceChannel){
chan = channel;
break;
}
}
if(client.internal.voiceConnections.get("id", chan.id)){
var connection = client.internal.voiceConnections.get("id", chan.id);
connection.stopPlaying();
if(client.internal.voiceConnection){
client.internal.voiceConnection.stopPlaying();
}
return;
}
if(m.content.startsWith("$$$")){
var chan;
for(var channel of m.channel.server.channels){
if(channel instanceof Discord.VoiceChannel){
chan = channel;
break;
}
}
if(client.internal.voiceConnections.get("id", chan.id)){
var connection = client.internal.voiceConnections.get("id", chan.id);
connection.playFile("C:/users/amish/desktop/Developers.mp3");
var rest = m.content.split(" ");
rest.splice(0, 1);
rest = rest.join(" ");
if(client.internal.voiceConnection){
var connection = client.internal.voiceConnection;
connection.playFile("C:/users/amish/desktop/"+rest);
}
}
});