mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
dont post radio if undefined
This commit is contained in:
parent
aab0e8b6db
commit
776bd6d7d6
@ -32,6 +32,7 @@ var radio = function(dbot) {
|
|||||||
|
|
||||||
stream.on('metadata', function(metadata) {
|
stream.on('metadata', function(metadata) {
|
||||||
var title = icecast.parseMetadata(metadata).StreamTitle;
|
var title = icecast.parseMetadata(metadata).StreamTitle;
|
||||||
|
if(!_.isUndefined(title)) {
|
||||||
_.each(this.config.announce, function(a) {
|
_.each(this.config.announce, function(a) {
|
||||||
dbot.say(a.server, a.name, dbot.t('now_playing', {
|
dbot.say(a.server, a.name, dbot.t('now_playing', {
|
||||||
'name': this.data['icy-name'],
|
'name': this.data['icy-name'],
|
||||||
@ -39,6 +40,7 @@ var radio = function(dbot) {
|
|||||||
'url': this.data['icy-url']
|
'url': this.data['icy-url']
|
||||||
}));
|
}));
|
||||||
}, this);
|
}, this);
|
||||||
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
stream.on('end', function() {
|
stream.on('end', function() {
|
||||||
@ -65,12 +67,12 @@ var radio = function(dbot) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.commands['~request'].regex = [/^request ([\d\w\s-]*)/, 2];
|
this.commands['~request'].regex = [/^request (.*)/, 2];
|
||||||
|
|
||||||
this.onLoad = function() {
|
this.onLoad = function() {
|
||||||
this.internalAPI.startRadio();
|
this.internalAPI.startRadio();
|
||||||
dbot.api.timers.addTimer(20000, function() {
|
dbot.api.timers.addTimer(20000, function() {
|
||||||
if(this.listening == false) {
|
if(this.listening === false) {
|
||||||
this.internalAPI.startRadio();
|
this.internalAPI.startRadio();
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
Loading…
Reference in New Issue
Block a user