telega/adapters/wisp
Values
pub fn handle_bot(
telega telega: telega.Telega(session, error),
req req: request.Request(wisp.Connection),
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(bot: Bot, req: Request) -> Response {
use <- telega_wisp.handle_bot(req, bot)
// ...
}