telega/telega_wisp
Functions
pub fn bot_handler(
bot: Bot,
req: Request(Connection),
) -> Response(Body)
Handle incoming requests from the Telegram API. Add this function as a handler to your wisp server.
import telega.{type Bot}
import telega/telega_wisp
fn handle_request(bot: Bot, req: Request) -> Response {
use req <- middleware(req)
use <- bool.lazy_guard(telega_wisp.is_bot_request(bot, req), fn() {
telega_wisp.bot_handler(bot, req)
})
case wisp.path_segments(req) {
["helath"] -> wisp.ok()
_ -> wisp.not_found()
}
}
pub fn is_bot_request(bot: Bot, req: Request(Connection)) -> Bool