add support of subcontext initial actions

This commit is contained in:
2024-12-03 11:28:07 +06:00
parent d9488f8ccd
commit 856ae65fa8
3 changed files with 23 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ That is a set of libraries for plagubots. Look at the
### Technical help
#### FSM
In this bot has been used variant with FSM. That means that you may use all the [Behaviour Builder with FSM](https://bookstack.inmo.dev/books/telegrambotapi/page/behaviour-builder-with-fsm) functionality. In case you wish to setup states repo, you should use the next code in the `setupDI` of your plugin:
```kotlin
@@ -41,3 +43,16 @@ single<StateHandlingErrorHandler<State>> {
}
}
```
#### Subcontext initial actions
Bot will take all the `CombinedSubcontextInitialAction.SubItem`s from `Koin` to include it in root of
`behaviourBuilder`. To create your own subitem:
```kotlin
singleWithRandomQualifier<CombinedSubcontextInitialAction.SubItem> {
CombinedSubcontextInitialAction.SubItem {
// do some action or throw error to rerun on next round
}
}
```