improve messaging

This commit is contained in:
Alex Grintsvayg 2016-07-18 09:59:21 -04:00
parent 215260259c
commit 07cd535029

View file

@ -61,10 +61,10 @@ function respond(bot, data) {
function doBalance(bot, channel, tipper) {
lbry.getBalance(tipper, 1, function(err, balance) {
if (err) {
bot.postMessage(channel, 'Error getting balance');
bot.postMessage(channel, '<@' + tipper + '>: Error getting balance');
}
else {
bot.postMessage(channel, 'You have *' + balance + '* LBC');
bot.postMessage(channel, '<@' + tipper + '>: You have *' + balance + '* LBC');
}
});
}
@ -73,10 +73,10 @@ function doBalance(bot, channel, tipper) {
function doDeposit(bot, channel, tipper) {
getAddress(tipper, function(err, address) {
if (err) {
bot.postMessage(channel, 'Error getting deposit address');
bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address');
}
else {
bot.postMessage(channel, 'Your address is ' + address);
bot.postMessage(channel, '<@' + tipper + '>: Your address is ' + address);
}
});
}
@ -92,7 +92,7 @@ function doWithdraw(bot, channel, tipper, words) {
amount = words[3];
if (!validateAmount(amount)) {
bot.postMessage(channel, 'I dont know how to withdraw that many credits');
bot.postMessage(channel, '<@' + tipper + '>: I dont know how to withdraw that many credits');
return;
}
@ -101,7 +101,7 @@ function doWithdraw(bot, channel, tipper, words) {
bot.postMessage(channel, err.message);
}
else {
bot.postMessage(channel, 'You withdrew ' + amount + ' to ' + address + ' (' + txLink(txId) + ')');
bot.postMessage(channel, '<@' + tipper + '>: You withdrew ' + amount + ' to ' + address + ' (' + txLink(txId) + ')');
}
});
}
@ -117,7 +117,7 @@ function doTip(bot, channel, tipper, words) {
amount = words[2];
if (!validateAmount(amount)) {
bot.postMessage(channel, 'I dont know how to tip that many credits');
bot.postMessage(channel, '<@' + tipper + '>: I dont know how to tip that many credits');
return;
}
@ -131,7 +131,7 @@ function doTip(bot, channel, tipper, words) {
sendLbc(bot, channel, tipper, data.id, amount);
} else
{
bot.postMessage(channel, 'Sorry, I dont know that person');
bot.postMessage(channel, '<@' + tipper + '>: Sorry, I dont know that person');
}
})
}
@ -144,7 +144,10 @@ function doHelp(bot, channel) {
'`' + command + ' balance`: get your balance\n' +
'`' + command + ' deposit`: get address for deposits\n' +
'`' + command + ' withdraw ADDRESS AMOUNT`: withdraw AMOUNT credits to ADDRESS\n' +
'`' + command + ' USER AMOUNT`: send AMOUNT credits to USER\n'
'`' + command + ' USER AMOUNT`: send AMOUNT credits to USER\n' +
'\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 sending me an @message\n'
);
}
@ -160,7 +163,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 + ' (' + txLink(txId) + ')');
bot.postMessage(channel, 'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + id + '> ' + amount + ' LBC (' + txLink(txId) + ')');
}
});
}
@ -197,4 +200,4 @@ function validateAmount(amount) {
function txLink(txId) {
return "<https://explorer.lbry.io/tx/" + txId + "|tx>";
}
}