telega/flow/handler

Built-in step handlers and resume handler factories.

Values

pub fn create_resume_handler(
  flow: types.Flow(step_type, session, error),
) -> fn(bot.Context(session, error), update.Update) -> Result(
  bot.Context(session, error),
  error,
)

Create a router handler for resuming flows from callback queries

pub fn create_resume_handler_with_keyboard(
  flow: types.Flow(step_type, session, error),
  callback_data: keyboard.KeyboardCallbackData(String),
) -> fn(bot.Context(session, error), update.Update) -> Result(
  bot.Context(session, error),
  error,
)

Create a router handler for resuming flows from callback queries with keyboard parsing

pub fn create_text_handler(
  flow: types.Flow(step_type, session, error),
) -> fn(bot.Context(session, error), update.Update) -> Result(
  bot.Context(session, error),
  error,
)

Create a text handler for resuming flows

pub fn message_step(
  message_fn: fn(types.FlowInstance) -> String,
  next_step: option.Option(step_type),
) -> fn(bot.Context(session, error), types.FlowInstance) -> Result(
  #(
    bot.Context(session, error),
    types.FlowAction(step_type),
    types.FlowInstance,
  ),
  error,
)

Create a message display step

pub fn text_step(
  prompt: String,
  data_key: String,
  next_step: step_type,
) -> fn(bot.Context(session, error), types.FlowInstance) -> Result(
  #(
    bot.Context(session, error),
    types.FlowAction(step_type),
    types.FlowInstance,
  ),
  error,
)

Create a text input step

Search Document