Integrating final MSFT fixes

Now the last little changes have been implemented, had to modify how we got the user to message since we were previously getting the first user mentioned in the message, whereas we now match against all known users in the guild. This means users actually get messaged by, say, rolebot even if they're not in the channel you're tipping from. Of course you can't directly mention anyone not in the channel for multitip, so that's a non-issue in most use cases.

Also had to ensure certain function calls were sending the right type, because dynamic languages and lack of type safety.

That _should_ be absolutely everything needed to have it fully functional.
This commit is contained in:
ProfessorDey 2018-02-21 19:52:46 +00:00 committed by GitHub
parent b6598a4ffa
commit 8eb5bb9578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -274,8 +274,7 @@ function findUserIDsAndAmount(message, words, prv) {
idList.push(words[i].match(/[0-9]+/));
} else {
amount = getValidatedAmount(words[Number(count)+1]);
if (amount == null) break;
break
break;
}
}
return [idList, amount];
@ -283,12 +282,12 @@ function findUserIDsAndAmount(message, words, prv) {
function sendLBC(message, tipper, recipient, amount, privacyFlag) {
getAddress(recipient, function (err, address) {
getAddress(recipient.toString(), function (err, address) {
if (err) {
message.reply(err.message).then(message => message.delete(5000));
}
else {
lbry.sendFrom(tipper, address, amount, 1, null, null, function (err, txId) {
lbry.sendFrom(tipper, address, Number(amount), 1, null, null, function (err, txId) {
if (err) {
message.reply(err.message).then(message => message.delete(5000));
}
@ -299,8 +298,9 @@ function sendLBC(message, tipper, recipient, amount, privacyFlag) {
var authmsg = 'You have just privately tipped <@' + recipient + '> ' + amount + ' LBC.\n' + tx + msgtail;
message.author.send(authmsg);
if (message.author.id != message.mentions.users.first().id) {
var usr = message.guild.members.find('id', recipient).user;
var recipientmsg = 'You have just been privately tipped ' + amount + ' LBC by <@' + tipper + '>.\n' + tx + msgtail;
message.mentions.users.first().send(recipientmsg);
usr.send(recipientmsg);
}
} else {
var generalmsg =