From 115b6c3460cb55b14ae89b8bea7a7a582630d671 Mon Sep 17 00:00:00 2001 From: ProfessorDey <32119091+ProfessorDey@users.noreply.github.com> Date: Mon, 25 Dec 2017 20:22:36 +0100 Subject: [PATCH] Updated doHelp() & Added Self Tip Detection Updated doHelp() to match updated module description in Commit ec48f11 (https://github.com/lbryio/lbry-tipbot/commit/ec48f114d87feb77e4b6856ca6599659b51f201d#diff-baad512c11a603dedf1cf7f391e341bd) Also altered help logic so the help message is always DM'd to user to assist new users who struggle to find how to begin a dm session and to improve general usability. Further added a self tip check to sendLbc() to prevent duplicate messages being received by the user, so as to make clear that the tip is only being sent once. --- bot/modules/tipbot.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/modules/tipbot.js b/bot/modules/tipbot.js index 38dfc1f..51a1cf9 100644 --- a/bot/modules/tipbot.js +++ b/bot/modules/tipbot.js @@ -114,11 +114,9 @@ function doTip(message, tipper, words) { function doHelp(message) { if (!inPrivateOrBotSandbox(message)) { - message.reply('Please use <#369896313082478594> or DMs to talk to bots.'); - return; + message.reply('Sent you help via DM! Please use <#369896313082478594> or DMs to talk to bots.'); } - message.reply('Sent you help via DM!'); - message.author.send('**!tip**\n !tip balance: get your balance\n !tip deposit: get adress for your deposits\n !tip withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n !tip : send credits to '); + message.author.send('**!tip**\n balance: get your balance\n deposit: get address for your deposits\n withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n [private] : mention a user with @ and then the amount to tip them, or put private before the user to tip them privately.\n Key: [] : Optionally include contained keyword, <> : Replace with appropriate value.'); } @@ -138,7 +136,9 @@ function sendLbc(message, tipper, member, amount, privacyFlag) { 'DM me `!tip` for tipbot instructions.' if (privacyFlag) { message.author.send(imessage); - member.send(imessage); + if (message.author.id != member.id) { + member.send(imessage); + } } else { message.reply(imessage); }