Updated tipbot.js (Fixed some messages)

Changed a few things with when a tip is sent or errors out. (Instead of just "I don't know how to tip that amount", it sounds a bit better and more accurate.)
Changed the "Wubba lubba dub dub" message to something a bit more... normal? 
Also changed some phrasing with messages in general. Nothing that will change the functionality, more just the general appearance of the messages.
This commit is contained in:
Kenneth C 2018-10-05 23:23:03 -04:00 committed by GitHub
parent a82d7509c6
commit 128351e176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,7 @@ exports.multitip = {
exports.roletip = { exports.roletip = {
usage: '<subcommand>', usage: '<subcommand>',
description: 'Tip every user in a given role the same amount of LBC.', description: 'Tip all users in a specified role an amount of LBC.',
process: async function(bot, msg, suffix) { process: async function(bot, msg, suffix) {
let tipper = msg.author.id.replace('!', ''), let tipper = msg.author.id.replace('!', ''),
words = msg.content words = msg.content
@ -162,7 +162,7 @@ function doWithdraw(message, tipper, words, helpmsg) {
amount = getValidatedAmount(words[3]); amount = getValidatedAmount(words[3]);
if (amount === null) { if (amount === null) {
message.reply("I don't know how to withdraw that many credits...").then(message => message.delete(5000)); message.reply("Invalid amount of credits specified... Cannot withdraw credits.").then(message => message.delete(5000));
return; return;
} }
@ -170,7 +170,7 @@ function doWithdraw(message, tipper, words, helpmsg) {
if (err) { if (err) {
return message.reply(err.message).then(message => message.delete(5000)); return message.reply(err.message).then(message => message.delete(5000));
} }
message.reply(`You withdrew ${amount} LBC to ${address}. message.reply(`${amount} LBC has been withdrawn to ${address}.
${txLink(txId)}`); ${txLink(txId)}`);
}); });
} }
@ -190,13 +190,13 @@ function doTip(bot, message, tipper, words, helpmsg, MultiorRole) {
let amount = getValidatedAmount(words[amountOffset]); let amount = getValidatedAmount(words[amountOffset]);
if (amount === null) { if (amount === null) {
return message.reply("I don't know how to tip that many credits...").then(message => message.delete(5000)); return message.reply("Invalid amount of credits specified...").then(message => message.delete(5000));
} }
if (message.mentions.users.first() && message.mentions.users.first().id) { if (message.mentions.users.first() && message.mentions.users.first().id) {
return sendLBC(bot, message, tipper, message.mentions.users.first().id.replace('!', ''), amount, prv, MultiorRole); return sendLBC(bot, message, tipper, message.mentions.users.first().id.replace('!', ''), amount, prv, MultiorRole);
} }
message.reply('Sorry, I could not find a user in your tip...'); message.reply('Sorry, I could not find the user you are trying to tip...');
} }
function doMultiTip(bot, message, tipper, words, helpmsg, MultiorRole) { function doMultiTip(bot, message, tipper, words, helpmsg, MultiorRole) {
@ -214,11 +214,11 @@ function doMultiTip(bot, message, tipper, words, helpmsg, MultiorRole) {
} }
let [userIDs, amount] = findUserIDsAndAmount(message, words, prv); let [userIDs, amount] = findUserIDsAndAmount(message, words, prv);
if (amount == null) { if (amount == null) {
message.reply("I don't know how to tip that many credits...").then(message => message.delete(5000)); message.reply("Invalid amount of credits specified...").then(message => message.delete(5000));
return; return;
} }
if (!userIDs) { if (!userIDs) {
message.reply('Sorry, I could not find a user in your tip...').then(message => message.delete(5000)); message.reply('Sorry, I could not find the user you are trying to tip...').then(message => message.delete(5000));
return; return;
} }
for (let i = 0; i < userIDs.length; i++) { for (let i = 0; i < userIDs.length; i++) {
@ -239,7 +239,7 @@ function doRoleTip(bot, message, tipper, words, helpmsg, MultiorRole) {
} }
let amount = getValidatedAmount(words[amountOffset]); let amount = getValidatedAmount(words[amountOffset]);
if (amount == null) { if (amount == null) {
message.reply("I don't know how to tip that many LBC coins...").then(message => message.delete(10000)); message.reply("I don't know how to tip that amount of LBC...").then(message => message.delete(10000));
return; return;
} }
if (message.mentions.roles.first().id) { if (message.mentions.roles.first().id) {
@ -289,7 +289,7 @@ function sendLBC(bot, message, tipper, recipient, amount, privacyFlag, MultiorRo
DM me with \`${message.content.split(' ', 1)[0]}\` for command specific instructions or with \`!tips\` for all available commands`; DM me with \`${message.content.split(' ', 1)[0]}\` for command specific instructions or with \`!tips\` for all available commands`;
if (privacyFlag) { if (privacyFlag) {
let usr = message.guild.members.find('id', recipient).user; let usr = message.guild.members.find('id', recipient).user;
let authmsg = `You have just privately tipped @${usr.tag} ${amount} LBC. let authmsg = `You have sent a private tip to @${usr.tag} with the amount of ${amount} LBC.
${tx}${msgtail}`; ${tx}${msgtail}`;
message.author.send(authmsg); message.author.send(authmsg);
if (message.author.id !== message.mentions.users.first().id) { if (message.author.id !== message.mentions.users.first().id) {
@ -298,7 +298,7 @@ ${tx}${msgtail}`;
usr.send(recipientmsg); usr.send(recipientmsg);
} }
} else { } else {
let generalmsg = `Wubba lubba dub dub! <@${tipper}> tipped <@${recipient}> ${amount} LBC. let generalmsg = `<@${tipper}> success! You have sent a tip. <@${recipient}> has been tipped ${amount} LBC.
${tx}${msgtail}`; ${tx}${msgtail}`;
message.reply(generalmsg); message.reply(generalmsg);
} }