mirror of
https://github.com/LBRYFoundation/lbry-tipbot.git
synced 2025-08-23 16:57:24 +00:00
improve messaging
This commit is contained in:
parent
215260259c
commit
07cd535029
1 changed files with 14 additions and 11 deletions
25
tipbot.js
25
tipbot.js
|
@ -61,10 +61,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, 'Error getting balance');
|
bot.postMessage(channel, '<@' + tipper + '>: Error getting balance');
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
function doDeposit(bot, channel, tipper) {
|
||||||
getAddress(tipper, function(err, address) {
|
getAddress(tipper, function(err, address) {
|
||||||
if (err) {
|
if (err) {
|
||||||
bot.postMessage(channel, 'Error getting deposit address');
|
bot.postMessage(channel, '<@' + tipper + '>: Error getting deposit address');
|
||||||
}
|
}
|
||||||
else {
|
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];
|
amount = words[3];
|
||||||
|
|
||||||
if (!validateAmount(amount)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ function doWithdraw(bot, channel, tipper, words) {
|
||||||
bot.postMessage(channel, err.message);
|
bot.postMessage(channel, err.message);
|
||||||
}
|
}
|
||||||
else {
|
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];
|
amount = words[2];
|
||||||
|
|
||||||
if (!validateAmount(amount)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,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, '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 + ' balance`: get your balance\n' +
|
||||||
'`' + command + ' deposit`: get address for deposits\n' +
|
'`' + command + ' deposit`: get address for deposits\n' +
|
||||||
'`' + command + ' withdraw ADDRESS AMOUNT`: withdraw AMOUNT credits to ADDRESS\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);
|
bot.postMessage(channel, err.message);
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
function txLink(txId) {
|
||||||
return "<https://explorer.lbry.io/tx/" + txId + "|tx>";
|
return "<https://explorer.lbry.io/tx/" + txId + "|tx>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue