plugins/gateways/telegram/adapter

Telegram adapter — bridge between our Session type and telega’s types. Provides SessionSettings for persistence, a catch handler, and key conversion.

Values

pub fn build_session_key(telega_key: String) -> String

Convert a telega context key (“{chat_id}:{from_id}”) to our session key format (“telegram:{chat_id}:{from_id}”).

pub fn catch_handler(
  log: behaviours.Logger,
) -> fn(bot.Context(session.Session, String), String) -> Result(
  Nil,
  String,
)

Default catch handler that logs the error and continues. Errors in route handlers or persistence are surfaced here.

pub fn session_settings(
  conn: sqlight.Connection,
  persona: String,
  store: behaviours.SessionStore,
  log: behaviours.Logger,
) -> bot.SessionSettings(session.Session, String)

Build session settings that bridge our Session type with telega’s framework. Captures conn and persona in closures for get/persist/default_session.

Search Document