From 3d1b8d687bb58bd88d854ab53efe564d3a903b69 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Mon, 18 Jul 2016 10:07:41 -0400 Subject: [PATCH] fix icon --- tipbot.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tipbot.js b/tipbot.js index f1c3b1f..eb94a4c 100644 --- a/tipbot.js +++ b/tipbot.js @@ -22,13 +22,17 @@ function init(rpcuser, rpcpassword) { }); } +var globalSlackParams = { + icon_emoji: ':money_with_wings:' +}; + function respond(bot, data) { var tipper = data.user, channel = data.channel, words = data.text.trim().split(' '); if (!lbry) { - bot.postMessage(channel, 'Failed to connect to lbrycrd'); + bot.postMessage(channel, 'Failed to connect to lbrycrd', {icon_emoji: ':exclamation:'}); return; } @@ -61,10 +65,10 @@ function respond(bot, data) { function doBalance(bot, channel, tipper) { lbry.getBalance(tipper, 1, function(err, balance) { if (err) { - bot.postMessage(channel, '<@' + tipper + '>: Error getting balance'); + bot.postMessage(channel, '<@' + tipper + '>: Error getting balance', {icon_emoji: ':exclamation:'}); } else { - bot.postMessage(channel, '<@' + tipper + '>: You have *' + balance + '* LBC'); + bot.postMessage(channel, '<@' + tipper + '>: You have *' + balance + '* LBC', globalSlackParams); } }); } @@ -73,10 +77,10 @@ function doBalance(bot, channel, tipper) { function doDeposit(bot, channel, tipper) { getAddress(tipper, function(err, address) { if (err) { - bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address'); + bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address', {icon_emoji: ':exclamation:'}); } else { - bot.postMessage(channel, '<@' + tipper + '>: Your address is ' + address); + bot.postMessage(channel, '<@' + tipper + '>: Your address is ' + address, globalSlackParams); } }); } @@ -92,7 +96,7 @@ function doWithdraw(bot, channel, tipper, words) { amount = words[3]; if (!validateAmount(amount)) { - bot.postMessage(channel, '<@' + tipper + '>: I dont know how to withdraw that many credits'); + bot.postMessage(channel, '<@' + tipper + '>: I dont know how to withdraw that many credits', globalSlackParams); return; } @@ -101,7 +105,7 @@ function doWithdraw(bot, channel, tipper, words) { bot.postMessage(channel, err.message); } else { - bot.postMessage(channel, '<@' + tipper + '>: You withdrew ' + amount + ' to ' + address + ' (' + txLink(txId) + ')'); + bot.postMessage(channel, '<@' + tipper + '>: You withdrew ' + amount + ' to ' + address + ' (' + txLink(txId) + ')', globalSlackParams); } }); } @@ -117,7 +121,7 @@ function doTip(bot, channel, tipper, words) { amount = words[2]; if (!validateAmount(amount)) { - bot.postMessage(channel, '<@' + tipper + '>: I dont know how to tip that many credits'); + bot.postMessage(channel, '<@' + tipper + '>: I dont know how to tip that many credits', globalSlackParams); return; } @@ -131,7 +135,7 @@ function doTip(bot, channel, tipper, words) { sendLbc(bot, channel, tipper, data.id, amount); } else { - bot.postMessage(channel, '<@' + tipper + '>: Sorry, I dont know that person'); + bot.postMessage(channel, '<@' + tipper + '>: Sorry, I dont know that person', globalSlackParams); } }) } @@ -148,7 +152,7 @@ function doHelp(bot, channel) { '\n' + 'Send me a Direct Message if you want to interact privately.\n' + 'If I\'m not responding in some channel, you can invite me by @mentioning me\n' - ); + , globalSlackParams); } @@ -163,7 +167,7 @@ function sendLbc(bot, channel, tipper, id, amount) { bot.postMessage(channel, err.message); } else { - bot.postMessage(channel, 'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + id + '> ' + amount + ' LBC (' + txLink(txId) + ')'); + bot.postMessage(channel, 'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + id + '> ' + amount + ' LBC (' + txLink(txId) + ')', globalSlackParams); } }); }