mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2025-09-15 13:29:46 +00:00
add support of subcontext initial actions
This commit is contained in:
15
README.md
15
README.md
@@ -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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user