create-input-chain

star 247

[Bot developer] Creates multi-step input chains for conversation flows using the telegram-bot DSL. Use when building simple multi-step dialogs without wizard state persistence, or when inputChain is preferred over @WizardHandler.

vendelieu By vendelieu schedule Updated 2/14/2026

name: create-input-chain description: [Bot developer] Creates multi-step input chains for conversation flows using the telegram-bot DSL. Use when building simple multi-step dialogs without wizard state persistence, or when inputChain is preferred over @WizardHandler.

Create Input Chain

Quick Start

Define a chain inside bot.setFunctionality { }. Set bot.inputListener[user] = "id" to start. The chain advances automatically after each step.

bot.setFunctionality {
    onCommand("/start") {
        message { "What's your name?" }.send(user, bot)
        bot.inputListener[user] = "conversation"
    }
    inputChain("conversation") {
        message { "Nice to meet you, ${message.text}!" }.send(update.getUser(), bot)
        message { "What's your favorite food?" }.send(update.getUser(), bot)
    }.breakIf({ message.text == "peanut butter" }) {
        message { "Oh, too bad, I'm allergic." }.send(update.getUser(), bot)
    }.andThen {
        message { "Thanks! You said: ${message.text}" }.send(update.getUser(), bot)
    }
}
bot.handleUpdates()

Structure

  • inputChain("id") { } — First step. Block runs when user sends a message while inputListener is "id".
  • andThen { } — Next step. Chain advances to this step after the previous block runs.
  • breakIf(condition, repeat = true, block) — On current step: if condition is true, run block. If repeat = true, stay on current step (user can re-enter). If repeat = false, do not re-register.

Context

Inside each block, ProcessingContext / ActivityCtx provides:

  • update — the ProcessedUpdate
  • message — shortcut for message content (when applicable)
  • update.getUser() — user reference

When to Use

  • Input chain: Simple linear flows, no typed state, quick setup
  • Wizard: Complex validation, typed state, Transition.JumpTo/Retry, state managers

Reference

Install via CLI
npx skills add https://github.com/vendelieu/telegram-bot --skill create-input-chain
Repository Details
star Stars 247
call_split Forks 17
navigation Branch main
article Path SKILL.md
More from Creator