telega/adapters/wisp

Values

pub fn handle_bot(
  request req: request.Request(//internal),
  telega telega: telega.Telega(session, error),
  next handler: fn() -> response.Response(wisp.Body),
) -> response.Response(wisp.Body)

A middleware function to handle incoming requests from the Telegram API. Handles a request to the bot webhook endpoint, decodes the incoming message, validates the secret token, and passes the message to the bot for processing.

import wisp.{type Request, type Response}
import telega.{type Bot}
import telega/adapters/wisp as telega_wisp

fn handle_request(req: Request, bot: Bot) -> Response {
  use <- telega_wisp.handle_bot(req)
  // ...
}
Search Document