Fixing Duplicate Tipbot Account Issue #9

Merged
ProfessorDey merged 1 commit from patch-3 into master 2018-01-03 01:23:49 +01:00

View file

@ -102,9 +102,8 @@ function doTip(message, tipper, words) {
return; return;
} }
if (message.mentions.members.first().id) { if (message.mentions.users.first().id) {
let member = message.mentions.members.first() sendLbc(message, tipper, message.mentions.users.first().id.replace('!', ''), amount, prv);
sendLbc(message, tipper, member, amount, prv);
} }
else { else {
message.reply('Sorry, I could not find a user in your tip...'); message.reply('Sorry, I could not find a user in your tip...');
@ -122,8 +121,8 @@ function doHelp(message) {
} }
function sendLbc(message, tipper, member, amount, privacyFlag) { function sendLbc(message, tipper, recipient, amount, privacyFlag) {
getAddress(member.id.replace('!', ''), function (err, address) { getAddress(recipient, function (err, address) {
if (err) { if (err) {
message.reply(err.message); message.reply(err.message);
} }
@ -134,11 +133,13 @@ function sendLbc(message, tipper, member, amount, privacyFlag) {
} }
else { else {
var imessage = var imessage =
'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + member.id + '> ' + amount + ' LBC (' + txLink(txId) + '). ' + 'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + recipient + '> ' + amount + ' LBC (' + txLink(txId) + '). ' +
'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 != message.mentions.users.first().id) {
message.mentions.users.first().send(imessage);
}
} else { } else {
message.reply(imessage); message.reply(imessage);
} }