3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-03 17:39:28 +01:00

dont post radio if undefined

This commit is contained in:
reality 2014-07-19 19:58:22 +00:00
parent aab0e8b6db
commit 776bd6d7d6

View File

@ -32,13 +32,15 @@ var radio = function(dbot) {
stream.on('metadata', function(metadata) {
var title = icecast.parseMetadata(metadata).StreamTitle;
_.each(this.config.announce, function(a) {
dbot.say(a.server, a.name, dbot.t('now_playing', {
'name': this.data['icy-name'],
'song': title,
'url': this.data['icy-url']
}));
}, this);
if(!_.isUndefined(title)) {
_.each(this.config.announce, function(a) {
dbot.say(a.server, a.name, dbot.t('now_playing', {
'name': this.data['icy-name'],
'song': title,
'url': this.data['icy-url']
}));
}, this);
}
}.bind(this));
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.internalAPI.startRadio();
dbot.api.timers.addTimer(20000, function() {
if(this.listening == false) {
if(this.listening === false) {
this.internalAPI.startRadio();
}
}.bind(this));