telega/adapters/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/adapters/wisp as telega_wisp
fn handle_request(bot: Bot, req: Request) -> Response {
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 decode_to_string(error: DecodeError) -> String
Format decode error to error message string.
pub fn is_bot_request(bot: Bot, req: Request(Connection)) -> Bool