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

Feature: State Machine #26

Merged
merged 18 commits into from
Mar 14, 2024
Merged

Conversation

JumpLink
Copy link
Collaborator

@JumpLink JumpLink commented Mar 7, 2024

The main goal of this PR is to implement a StateMachineService as described in #25

  • based on valtio (vanillla-version)
  • Used to create a proxy state object using StateMachineService.create for each chat session (sessions are handled using Grammy's session plugin)
  • Changes on the state (or any sub property) can be subscribed using StateMachineService.subscribe or by watching the forwarded event

Other improvements:

  • Commands, Services and EventManagers now have a getSingleton (which internal resolves the DI singleton with the tools provided)
  • In order to be able to cancel a running process such as answering callouts, we now make use of the native AbortController, this is assigned to a session so that it can be cancelled from anywhere
  • Commands now have a new property visibleOnStates to define in which states this command should be visible
  • New commands: /help, /debug and /cancel
  • Renamed TelegramService to AppService
  • Improved documentation
  • Cleanups where it just fits

@JumpLink JumpLink marked this pull request as ready for review March 14, 2024 11:59
@JumpLink JumpLink self-assigned this Mar 14, 2024
@JumpLink JumpLink requested a review from wpf500 March 14, 2024 12:00
@JumpLink JumpLink removed their assignment Mar 14, 2024
Copy link
Member

@wpf500 wpf500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I obviously don't know the codebase well but from what I can tell it all looks great 😄

@JumpLink JumpLink merged commit 10cbc6b into feat/instruction-message Mar 14, 2024
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.

2 participants