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 a futures-based confirmation flow #22

Open
LivInTheLookingGlass opened this issue Oct 20, 2022 · 1 comment
Open

Make a futures-based confirmation flow #22

LivInTheLookingGlass opened this issue Oct 20, 2022 · 1 comment

Comments

@LivInTheLookingGlass
Copy link
Owner

Telegram code needs to be quarantined to a submodule. The easiest way to do this is to define a standard flow for confirming, then having submodules implement hooks for that flow.

Those hooks are

  • get_action
  • get_action_args
  • get_confirmation

Then wrap the following flow in a Future

confirmed = False
args = ()
kwargs = {}
while not confirmed:
    next_step = get_action(explanation)
    explanation += str(next_step) + '\n'
    if next_step requires args:
        args, kwargs = get_action_args(explanation)
        explanation += f'{args}, {kwargs}\n'
    confirmed = get_confirmation(explanation)
return next_step, args, kwargs
@LivInTheLookingGlass
Copy link
Owner Author

Will do after #31

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

No branches or pull requests

1 participant