Updated doHelp() & Added Self Tip Detection

Updated doHelp() to match updated module description in Commit ec48f11 (ec48f114d8 (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.
This commit is contained in:
ProfessorDey 2017-12-25 20:22:36 +01:00 committed by GitHub
parent 4df306e7ce
commit 115b6c3460
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,11 +114,9 @@ function doTip(message, tipper, words) {
function doHelp(message) { function doHelp(message) {
if (!inPrivateOrBotSandbox(message)) { if (!inPrivateOrBotSandbox(message)) {
message.reply('Please use <#369896313082478594> or DMs to talk to bots.'); message.reply('Sent you help via DM! Please use <#369896313082478594> or DMs to talk to bots.');
return;
} }
message.reply('Sent you help via DM!'); 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] <user> <amount>: 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.');
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 <user> <amount>: send <amount> credits to <user>');
} }
@ -138,7 +136,9 @@ function sendLbc(message, tipper, member, amount, privacyFlag) {
'DM me `!tip` for tipbot instructions.' 'DM me `!tip` for tipbot instructions.'
if (privacyFlag) { if (privacyFlag) {
message.author.send(imessage); message.author.send(imessage);
member.send(imessage); if (message.author.id != member.id) {
member.send(imessage);
}
} else { } else {
message.reply(imessage); message.reply(imessage);
} }