fix icon
This commit is contained in:
parent
2de7db0d8f
commit
3d1b8d687b
1 changed files with 15 additions and 11 deletions
26
tipbot.js
26
tipbot.js
|
@ -22,13 +22,17 @@ function init(rpcuser, rpcpassword) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var globalSlackParams = {
|
||||||
|
icon_emoji: ':money_with_wings:'
|
||||||
|
};
|
||||||
|
|
||||||
function respond(bot, data) {
|
function respond(bot, data) {
|
||||||
var tipper = data.user,
|
var tipper = data.user,
|
||||||
channel = data.channel,
|
channel = data.channel,
|
||||||
words = data.text.trim().split(' ');
|
words = data.text.trim().split(' ');
|
||||||
|
|
||||||
if (!lbry) {
|
if (!lbry) {
|
||||||
bot.postMessage(channel, 'Failed to connect to lbrycrd');
|
bot.postMessage(channel, 'Failed to connect to lbrycrd', {icon_emoji: ':exclamation:'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +65,10 @@ function respond(bot, data) {
|
||||||
function doBalance(bot, channel, tipper) {
|
function doBalance(bot, channel, tipper) {
|
||||||
lbry.getBalance(tipper, 1, function(err, balance) {
|
lbry.getBalance(tipper, 1, function(err, balance) {
|
||||||
if (err) {
|
if (err) {
|
||||||
bot.postMessage(channel, '<@' + tipper + '>: Error getting balance');
|
bot.postMessage(channel, '<@' + tipper + '>: Error getting balance', {icon_emoji: ':exclamation:'});
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
function doDeposit(bot, channel, tipper) {
|
||||||
getAddress(tipper, function(err, address) {
|
getAddress(tipper, function(err, address) {
|
||||||
if (err) {
|
if (err) {
|
||||||
bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address');
|
bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address', {icon_emoji: ':exclamation:'});
|
||||||
}
|
}
|
||||||
else {
|
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];
|
amount = words[3];
|
||||||
|
|
||||||
if (!validateAmount(amount)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +105,7 @@ function doWithdraw(bot, channel, tipper, words) {
|
||||||
bot.postMessage(channel, err.message);
|
bot.postMessage(channel, err.message);
|
||||||
}
|
}
|
||||||
else {
|
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];
|
amount = words[2];
|
||||||
|
|
||||||
if (!validateAmount(amount)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +135,7 @@ function doTip(bot, channel, tipper, words) {
|
||||||
sendLbc(bot, channel, tipper, data.id, amount);
|
sendLbc(bot, channel, tipper, data.id, amount);
|
||||||
} else
|
} 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' +
|
'\n' +
|
||||||
'Send me a Direct Message if you want to interact privately.\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'
|
'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);
|
bot.postMessage(channel, err.message);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue