Permalink
Browse files

Discord.js upgrade to fix voice channel tracking issues.

  • Loading branch information...
roncli committed Aug 18, 2016
1 parent cd53927 commit ee168f7c26882127807da262003d18e82466edb0
Showing with 9 additions and 15 deletions.
  1. +4 −0 README.md
  2. +2 −2 package.json
  3. +3 −13 sixgaming.js
View
@@ -89,6 +89,10 @@ The following should be the contents of settings.js:
Version History
===============
1.1.4
-----
* Fixed voice channel issues.
1.1.3 - 7/23/2016
-----------------
* Added Ana to `!randomonium`.
View
@@ -1,6 +1,6 @@
{
"name": "SixBotGG",
"version": "1.1.3",
"version": "1.1.4",
"description": "A Twitch IRC bot for Six Gaming.",
"homepage": "https://github.com/roncli/SixBotGG",
"bugs": {
@@ -18,7 +18,7 @@
"url": "https://github.com/roncli/SixBotGG.git"
},
"dependencies": {
"discord.js": "8.0.0",
"discord.js": "8.1.0",
"irc": "0.5.0",
"mssql": "3.3.0",
"promised-io": "0.3.5",
View
@@ -11,8 +11,6 @@ var pjson = require("./package.json"),
hostingTimestamps = [],
liveChannels = {},
channelDeletionTimeouts = {},
userChannels = {},
channelCounts = {},
userCreatedChannels = {},
autoCommandRotation = [
"facebook",
@@ -393,22 +391,14 @@ SixGaming.start = function(_irc, _discord, _twitch) {
});
discord.addListener("voiceJoin", function(channel, user) {
userChannels[user.id] = channel.id;
channelCounts[channel.id] = channelCounts[channel.id] ? channelCounts[channel.id] + 1 : 1;
if (channelDeletionTimeouts[channel.id]) {
clearTimeout(channelDeletionTimeouts[channel.id]);
delete channelDeletionTimeouts[channel.id];
}
});
discord.addListener("voiceLeave", function(channel, user) {
if (!userChannels[user.id]) {
return;
}
channel = sixDiscord.channels.get("id", userChannels[user.id]);
delete userChannels[user.id];
channelCounts[channel.id]--;
if (channel.name !== "\u{1F4AC} General" && channelCounts[channel.id] === 0) {
if (channel.name !== "\u{1F4AC} General" && channel.members.length === 0) {
SixGaming.markEmptyVoiceChannel(channel);
}
});
@@ -1007,7 +997,7 @@ SixGaming.discordMessages = {
return;
}
if (!channelCounts[channel.id] || channelCounts[channel.id] === 0) {
if (channel.members.length === 0) {
SixGaming.markEmptyVoiceChannel(channel);
}
userCreatedChannels[user.id] = setTimeout(function() {
@@ -1192,7 +1182,7 @@ SixGaming.discordMessages = {
});
for (index = 0; index < user.voiceChannel.members.length; index++) {
if (user.voiceChannel && user.voiceChannel.members[index].voiceChannel && user.voiceChannel.id === user.voiceChannel.members[index].voiceChannel.id && user.voiceChannel.members[index] && userChannels[user.voiceChannel.members[index].id] && userChannels[user.voiceChannel.members[index].id] === user.voiceChannel.id) {
if (user.voiceChannel && user.voiceChannel.members[index].voiceChannel && user.voiceChannel.id === user.voiceChannel.members[index].voiceChannel.id && user.voiceChannel.members[index]) {
SixGaming.discordQueue(user.voiceChannel.members[index] + ": " + owHeroes[index]);
if (message === "dupe" || message === "dupes") {
owHeroes.sort(function() {

0 comments on commit ee168f7

Please sign in to comment.