Optimise Help Msg & Wrong Channel Warning #12

Closed
ProfessorDey wants to merge 0 commits from patch-4 into master
ProfessorDey commented 2018-02-01 11:33:32 +01:00 (Migrated from github.com)

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.

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.
nikooo777 commented 2018-02-01 16:09:10 +01:00 (Migrated from github.com)

Thank you for the extensive review and PR, I will check it later tonight (hopefully i'll feel better by then) and merge it if it's fine :)

Thank you for the extensive review and PR, I will check it later tonight (hopefully i'll feel better by then) and merge it if it's fine :)
ProfessorDey commented 2018-02-06 07:25:32 +01:00 (Migrated from github.com)

This pull request I'm closing as it is included in the new pull request I've put in just now, #13

This pull request I'm closing as it is included in the new pull request I've put in just now, #13

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-tipbot#12
No description provided.