Formatting corrections: URL contained markdown which is only supported in `embed: {}`
Duplicate command removed: `!tip` and `!tips` now display the same message so only one required.
Duplicate tipper name removed: The bot mentioned the tippers name twice concurrently.
Removed unnecessary code: Unnecessary code removed `${message.content.split(' ', 1)[0]}\`
Removed author: Author was set as `!tip` and not required.
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.
Apparently despite being a supposedly smart language, JS still insists on making me convert a string of numbers from a number back to a string before _and_ inside a function call, yay aggressively dynamically typed languages.
This _should_ fix the matter now
So it turns out that if you try to print a userid of someone that isn't in that server, such as in a dm channel, it simply displays as invalid user (Even though userids are unique across the entirety of discord, got to love that logic). So now the private message instead uses the .username and .tag attributes to provide the normal userid, like so: @GenericUser#1234
While this may be a tad confusing to those using nicknames, it identifies the exact individual doing the tipping, it just might require a little digging.
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.
All finally operational and tested on MSFT's RVN server, code ported back over after figuring out various JS specific implementation issues. Now all works correctly and doesn't include anyone it shouldn't.
Implements MSFTblockchain's fixes from PR #4 without customisations or version regression.
Now requires Node.js Regex module for testing for user mentions in text with regex, including a fallback if a unit test fails.
Also adds !tipcommands command which gives an up to date list of all commands tipbot accepts with a brief description of each.
The tip message tail about DMing tipbot is now contextualised to give the appropriate !<command> and also points users towards the new !tipcommands command.
Private tip messages are now a bit nicer to read and prv is now a boolean flag to fix some odd errors that were occuring.
Error Messages now delete themselves after a short time for cleanliness.
Help messages are now in Discord Embeds to line up with Wunderbot, though this currently ignores tabs, so help messages don't quite match the requested format. Commands have been made bold to prevent confusion.
Everything should now actually work, but will require testing to be sure.
This is actually not too substantial an addition. it adds 2 additional command exports for tipbot, namely !multitip and !roletip.
!multitip [private] <user>+ <amount>
The more complex new feature, this command will take a list of users, seperated by spaces, and passes through to doTip() if you only list a single user. It tests each word past the ! command and private tag, checking for a user mention using the regex.test() function of the Discord.js USERS_PATTERN, using that to count the number of users mentioned in a row, then takes the first word that is not a match to be the amount. Error checking then returns the appropriate errors to the user, if any. Otherwise it proceeds to send tips to each user individually. this results in messages for every user that receives a tip, which can be messy. It will also message the author once for every user a tip is sent to, if using private mode, this isn't ideal, but would require rewriting the sendLbc() function, which is outside the scope of this commit.
!roletip <role> <amount>
This is a relatively simpler feature, the command taking a single role and an amount, then extracting the userIDs from the role via the Roles.members and GuildMember.user values. It will return seperate errors for a lack of a role in the message and the lack of any users in a role. Like the !multitip command, it will send tips individually to each user, with the same spam of messages either in the channel or the author's private channel.