telega/model/decoder

This module contains all decoders for types Telegram Bot API.

Values

pub fn lenient_float() -> decode.Decoder(Float)

Telegram serialises floats as plain JSON numbers, so a Float field can arrive as an integer ("latitude": 51). Accept either shape.

pub fn lenient_update_decoder() -> decode.Decoder(types.Update)

Decode one update, degrading gracefully: an update whose payload this version cannot read still yields its update_id, so the caller can keep the rest of the batch and still advance the polling offset past it. Such an update decodes to update.UnknownUpdate.

pub fn messages_array_decoder() -> decode.Decoder(
  List(types.Message),
)
pub fn rich_text_decoder() -> decode.Decoder(types.RichText)

Hand-written: the RichText union is recursive and mixes bare String and Array of RichText members with type-tagged records, so no discriminated decoder can be generated. decode.recursive breaks the construction cycle with the generated RichText* record decoders.

Search Document