Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensible commands and abstraction of utility functions #91

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jordanella
Copy link

Abstracted commands outside of the Searcharr class into their own unique modules and implemented dynamic loading and registration of command modules through a command class to allow for easier future extensibility. The validation of authentication and enabled settings at the beginning of respective action requests has been made into a list for each module.

Moved _load_language, _xlate, and _strip_entities functions to a util module. The logger was also moved to util. Translation and logging functions were relocated to eliminate any requirement of dependency injection of the Searcharr class for their use in commands or other modules. The xlate_aliases function was created to minimize code reuse of command populated messages.

The KeyboardInlineButton definitions were moved to a new buttons module to improve readability of _prepare_reponse and _prepare_user_response functions.

Abstracted commands outside of the Searcharr class and implemented dynamic loading and registration of command modules to allow for future extensibility.
Moved _load_language, _xlate, and _strip_entities functions to a utility module. Language is loaded into the utility module to curb dependency on the Searcharr class for translation function in commands or other modules.

The KeyboardInlineButton definitions were moved to a new buttons module to make the _prepare_reponse and _prepare_user_response functions more readable.

Revised the calculations for _prepare_response_users pagination to eliminate offset and num so that it can use the same navigation button code as _prepare_response.
Cleaned up any left over or missing arguments from the button migration.

Modified references to series_commands, movie_commands, and book_commands to be consistent with all the other command alias functions so that it would work with a unified method to reduce code reuse.
No new line at end of file, order of imports, and various whitespace concerns.
@kevindelaney
Copy link

This is awesome and opens a lot of doors for easier expansion in the future. Great stuff.

@toddrob99
Copy link
Owner

@jordanella is this all still valid? I remember you mentioned you were working on some additional changes, so I was holding off merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants