From 21eab082bf2fda36a57d60841e10c15a2cc275d1 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 17 Feb 2014 20:11:11 +0000 Subject: [PATCH] fuck lag --- modules/radio/radio.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/radio/radio.js b/modules/radio/radio.js index dd1e2df..a214248 100644 --- a/modules/radio/radio.js +++ b/modules/radio/radio.js @@ -38,10 +38,22 @@ var radio = function(dbot) { })); }, this); }.bind(this)); - }.bind(this) + + stream.on('end', function() { + this.listening = false; + }.bind(this)); + }.bind(this), + + 'getRadio': function() { + dbot.api.timers.addTimer(20000, function() { + if(this.listening == false) { + this.internalAPI.startRadio(); + } + }.bind(this)); + } }; this.onLoad = function() { - this.internalAPI.startRadio(); + this.internalAPI.getRadio(); }.bind(this); };