Adding Multi User & Role Tipping and Help/Warning Optimisation #13

Merged
ProfessorDey merged 11 commits from master into master 2018-02-28 22:54:00 +01:00

11 commits

Author SHA1 Message Date
Niko Storni
8a29b053a0
missed 2 coins -> credits 2018-02-22 02:35:49 +01:00
Niko Storni
6cfd4f578e
updated default configuration 2018-02-22 02:26:39 +01:00
Niko Storni
f2c784dc23
Merge branch 'master' into multirole
ported over the changes made in master
changed vars to let
simplified code
added missing dependency to package.json
2018-02-22 02:22:58 +01:00
ProfessorDey
8eb5bb9578
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.
2018-02-21 19:52:46 +00:00
ProfessorDey
b6598a4ffa
Final functionality fixes from MSFTblockchain
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.
2018-02-12 22:43:37 +00:00
ProfessorDey
f239d5f394
Implement MSFTblockchain's Fixes
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.
2018-02-12 13:48:38 +00:00
ProfessorDey
dbcaca301e
Grammar fixes and un-hardcode bot-sandbox 2018-02-06 07:59:44 +00:00
aayanl
ad848c3ab1
Grammar fixes and un-hardcode bot-sandbox 2018-02-06 02:53:59 -05:00
ProfessorDey
623250e1b4
Adding Multi User Tipping and Role Tipping
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.
2018-02-06 06:18:05 +00:00
ProfessorDey
564a5d3135
Merge pull request #1 from ProfessorDey/patch-4
Update to latest
2018-02-06 01:46:31 +00:00
ProfessorDey
bef28e3e02
Optimise Help Msg & Wrong Channel Warning
This one involves a fair amount of reworking of the way functions operate, all checks for being in private or bot sandbox have been removed from functions and that functionality is now applied through privateOrSandboxOnly(), passing the message, channel warning, function to be called and then an array of arguments, sans message, as that's automatically attached at the head as all primary functions require the message anyway. while this makes each case entry a bit longer, it does reduce code reuse and potential for old code being left in, since each function had to previously be updated individually if something happened with the way these tests were carried out.

I've yet to find a way to allow us to set the export description and the help message in one fell swoop, so for now I've manually set the description. The help message itself is now broken down into pairs of subcommand and description, the subcommand will be indented once, while the description will be indented twice.

The way the help function now works is to allow everything to be set at the start, without needing to hunt all the way down to find the duplicate help message. Now everything can be replaced in the main function, though this will require a bit of computation with each request presently, as I don't know if or how the exported functions can access constants defined outside them. This can be optimised later if need be and at the very least shouldn't slow things down very much with the few entries that there are.

Unfortunately changing the way that the help message works does involve parameterising the help message itself for any function that requires it, but this also provides a helpful indicator of what functions might fail and fall back on the help function.
2018-02-01 10:33:18 +00:00