From 7f84716b59f512130f6ae3f416c4f630331831d2 Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Fri, 4 Apr 2014 09:50:58 -0500 Subject: [PATCH] Add a customizable ty message to new subscribers. --- lib/currency.js | 9 +++++++++ lib/initialize.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/currency.js b/lib/currency.js index bb23f14..6ea4194 100644 --- a/lib/currency.js +++ b/lib/currency.js @@ -152,6 +152,9 @@ function Currency(irc, db, commands, options) { // commands add/rem settings __self.command_add_string = options.add_command || 'addcmd'; __self.command_remove_string = options.remove_command || 'removecmd'; + + // message to new subscribers + __self.sub_ty_msg = options.sub_ty_msg || ''; } //-------- Methods --------- @@ -906,6 +909,12 @@ Currency.prototype.handout_coins = function () { __self.viewer_list.push(viewer); console.log("[*ADD NAME*] "+viewer+" from CHAT"); } + + // is this a new subscription notice? + if(viewer == 'twitchnotify') { + var subscriber = data_split[5].slice(1); + __self.irc.emit('message', {message:'> SUBHYPE: Thank you ' + subscriber + '. ' + __self.sub_ty_msg}); + } // log chat if enabled if (__self.irc.store_chat && __self.config.ignorelist.indexOf(viewer) < 0) { diff --git a/lib/initialize.js b/lib/initialize.js index 2f92ae7..fbdfad3 100644 --- a/lib/initialize.js +++ b/lib/initialize.js @@ -37,7 +37,8 @@ exports.initialize = function(options) { subscribers : config.twitch.subscribers, website : config.currency.website, modpowers : config.currency.modpowers, - ignorelist : config.ignorelist + ignorelist : config.ignorelist, + sub_ty_msg : config.currency.sub_ty_msg }); web = require('./web.js')(db, currency, { port : config.web.port,