telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Class LinearConversation<C>

    Modern Linear Conversation Handler.

    Allows writing complex interactive dialogs in a single, readable sequential async function.

    const survey = new LinearConversation(async (conversation, context) => {
    const name = await conversation.ask("What is your name?");
    const age = await conversation.ask(`Nice to meet you, ${name}! How old are you?`);
    await context.bot.sendMessage({
    chat_id: context.update!.effective_chat!.id,
    text: `Profile saved: ${name}, ${age} years old!`,
    });
    }, {
    entry_command: "survey",
    timeout_seconds: 120,
    });

    app.addHandler(survey);

    Type Parameters

    Hierarchy (View Summary)

    Index
    callback: HandlerCallback<C, void>

    The underlying callback function to invoke on match.

    • Checks whether the incoming update matches an active conversation step or entry trigger.

      Parameters

      • update: Update

        The incoming Telegram update.

      Returns Promise<boolean>

      true if this conversation should process the update, false otherwise.

    • Executes or resumes the linear conversation step.

      Parameters

      • update: Update

        The incoming Telegram update.

      • context: C

        Callback context instance.

      Returns Promise<void>

      Resolves when step execution finishes.