3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

requesting music for tripradio

Adding a command to ping the DJ that a user requests a song.
This commit is contained in:
thieson 2014-02-18 17:17:39 +01:00
parent 566c91a2b6
commit 7537d85084
2 changed files with 28 additions and 4 deletions

View File

@ -7,10 +7,10 @@ var _ = require('underscore')._,
icecast = require('icecast-stack'); icecast = require('icecast-stack');
var radio = function(dbot) { var radio = function(dbot) {
this.listening = false; this.listening = false;
this.data = false; this.data = false;
this.stream = false; this.stream = false;
this.internalAPI = { this.internalAPI = {
'startRadio': function() { 'startRadio': function() {
var stream = icecast.createReadStream(this.config.stream); var stream = icecast.createReadStream(this.config.stream);
this.stream = stream; this.stream = stream;
@ -55,6 +55,26 @@ var radio = function(dbot) {
}.bind(this)); }.bind(this));
}.bind(this) }.bind(this)
}; };
//requesting music by pinging the current DJ
//dj should be icy-description inside the headers
//user should be the requesting user
//request should be the event
//TODO:pm dj
this.commands={
'~request music': function(event){
var dj=this.data['icy-description'];
var user=event.user;
var request=event;
dbot.say(dbot.t('request',{
'dj':dj,
'user':user,
'song':song
}));
}
};
this.onLoad = function() { this.onLoad = function() {
this.internalAPI.getRadio(); this.internalAPI.getRadio();
}.bind(this); }.bind(this);

View File

@ -5,4 +5,8 @@
"now_playing": { "now_playing": {
"en": "Now Playing: {name} - {song} - {url}" "en": "Now Playing: {name} - {song} - {url}"
} }
"request":{
"en":"{dj}: User {user} requests '{song}' to be played on tripradio."
}
} }