Permalink
Browse files

Fix bug with streams crashing the bot.

  • Loading branch information...
roncli committed Nov 8, 2016
1 parent 4d4377b commit 2914fa9e3af3ff37a8ce140dcf4b29661e4f6932
Showing with 12 additions and 5 deletions.
  1. +12 −5 sixgaming.js
View
@@ -98,9 +98,16 @@ SixGaming.start = function(_irc, _discord, _twitch) {
}
// Get the list of live channels.
live = streams.map(function(stream) {
return stream.channel.name.toLowerCase();
});
try {
live = streams.map(function(stream) {
return stream.channel.name.toLowerCase();
});
} catch (err) {
console.log("Error checking streams.");
console.log(err, results);
setTimeout(checkStreams, 60000);
return;
}
// Being empty once is usually a sign of an error. Will try again next time.
if (live.length === 0) {
@@ -648,7 +655,7 @@ SixGaming.ircMessages = {
twitch.getChannelStream(message, function(err, results) {
manualHosting = !err && results && results.stream;
if (manualHosting) {
currentHost = message();
currentHost = message;
SixGaming.ircQueue("Now hosting " + currentHost + ". Check out their stream at http://twitch.tv/" + currentHost + "!");
SixGaming.ircQueue("/host " + currentHost);
if (results.stream.game) {
@@ -777,7 +784,7 @@ SixGaming.discordMessages = {
twitch.getChannelStream(message, function(err, results) {
manualHosting = !err && results && results.stream;
if (manualHosting) {
currentHost = message();
currentHost = message;
SixGaming.ircQueue("Now hosting " + currentHost + ". Check out their stream at http://twitch.tv/" + currentHost + "!");
SixGaming.ircQueue("/host " + currentHost);
if (results.stream.game) {

0 comments on commit 2914fa9

Please sign in to comment.