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

Make commands able to call each other without repeating code, and without tight coupling #28

Open
Snailedlt opened this issue Oct 4, 2021 · 0 comments
Labels
✨ enhancement New feature or request redesign architectural or structural re-design of the bot

Comments

@Snailedlt
Copy link
Member

Description

It would be neat if we could call other commands from within a command. For example, if someone calls the -handler command without an argument, it would be nice if the -help handler command was returned.


Ideas

I think we can use the Strategy Design Pattern, and make a strategy for each command. That way it get's decoupled from the command itself, making it less dependent on it, thus making it easier to call from other contexts.

Strategy Design Pattern explanation:
https://www.youtube.com/watch?v=SicL4fYCz8w

Example usage:
https://github.com/andreidimaano/Isabelle
https://github.com/andreidimaano/Isabelle/tree/master/src/strategy


Possible dependencies

  • TypeScript: We may need to add TypeScript for this to work as intended.
@Snailedlt Snailedlt added ✨ enhancement New feature or request redesign architectural or structural re-design of the bot labels Oct 4, 2021
@Snailedlt Snailedlt changed the title Make commands able to call each other without repeating code, or tight coupling Make commands able to call each other without repeating code, and without tight coupling Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request redesign architectural or structural re-design of the bot
Projects
None yet
Development

No branches or pull requests

1 participant