telega/adapters/wisp
Functions
pub fn handle_bot(
request req: Request(Connection),
telega telega: Telega(a),
next handler: fn() -> Response(Body),
) -> Response(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)
// ...
}