add-wizard-handler
Configures @WizardHandler annotation for wizard flows. Use when creating a new wizard, setting wizard triggers, scope, or state managers for the telegram-bot library.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Add Wizard Handler
Structure
Annotate an object or class with @WizardHandler. Nest WizardStep objects inside. KSP generates WizardActivity; no manual Activity class.
@WizardHandler(trigger = ["/start"])
object MyWizard {
object NameStep : WizardStep(isInitial = true) { ... }
object AgeStep : WizardStep { ... }
}
Parameters
| Parameter | Purpose | Default |
|---|---|---|
trigger |
Commands that start the wizard | Required |
scope |
Update types to check for trigger | [UpdateType.MESSAGE] |
stateManagers |
State manager classes for step storage | MapStringStateManager, MapIntStateManager, MapLongStateManager |
Trigger
-
trigger = ["/start"]— single command -
trigger = ["/start", "/register"]— multiple commands
Scope
-
scope = [UpdateType.MESSAGE]— commands in messages (default) -
scope = [UpdateType.CALLBACK_QUERY]— button-triggered wizard
State Managers
KSP matches each step's store() return type to a state manager:
-
String?→MapStringStateManager -
Int?→MapIntStateManager -
Long?→MapLongStateManager
Override per step with @WizardHandler.StateManager:
@WizardHandler(trigger = ["/start"], stateManagers = [CustomStateManager::class])
object MyWizard {
object NameStep : WizardStep { ... }
@WizardHandler.StateManager(OtherStateManager::class)
object AgeStep : WizardStep { ... }
}
Related Skills
- build-wizard-flow — Full wizard flow overview
- add-wizard-step — Implement WizardStep for each step
Reference
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!