From 7537d8508496bbc0fb103b592b6bd7bd65d0c7a0 Mon Sep 17 00:00:00 2001 From: thieson Date: Tue, 18 Feb 2014 17:17:39 +0100 Subject: [PATCH] requesting music for tripradio Adding a command to ping the DJ that a user requests a song. --- modules/radio/radio.js | 28 ++++++++++++++++++++++++---- modules/radio/strings.json | 4 ++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/radio/radio.js b/modules/radio/radio.js index 38ce3c0..6769ef1 100644 --- a/modules/radio/radio.js +++ b/modules/radio/radio.js @@ -7,10 +7,10 @@ var _ = require('underscore')._, icecast = require('icecast-stack'); var radio = function(dbot) { - this.listening = false; - this.data = false; - this.stream = false; - this.internalAPI = { + this.listening = false; + this.data = false; + this.stream = false; + this.internalAPI = { 'startRadio': function() { var stream = icecast.createReadStream(this.config.stream); this.stream = stream; @@ -55,6 +55,26 @@ var radio = function(dbot) { }.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.internalAPI.getRadio(); }.bind(this); diff --git a/modules/radio/strings.json b/modules/radio/strings.json index ecd3157..8a4c771 100644 --- a/modules/radio/strings.json +++ b/modules/radio/strings.json @@ -5,4 +5,8 @@ "now_playing": { "en": "Now Playing: {name} - {song} - {url}" } + + "request":{ + "en":"{dj}: User {user} requests '{song}' to be played on tripradio." + } }