telega/update

Types

pub type Command {
  Command(text: String, command: String, payload: Option(String))
}

Constructors

  • Command(text: String, command: String, payload: Option(String))

    Represents a command message.

    Arguments

    text

    Whole command message

    command

    Command name without the leading slash

    payload

    The command arguments, if any.

Messages represent the data that the bot receives from the Telegram API.

pub type Update {
  TextUpdate(
    from_id: Int,
    chat_id: Int,
    text: String,
    message: Message,
    raw: ModelUpdate,
  )
  CommandUpdate(
    from_id: Int,
    chat_id: Int,
    command: Command,
    message: Message,
    raw: ModelUpdate,
  )
  PhotoUpdate(
    from_id: Int,
    chat_id: Int,
    photos: List(PhotoSize),
    message: Message,
    raw: ModelUpdate,
  )
  VideoUpdate(
    from_id: Int,
    chat_id: Int,
    video: Video,
    message: Message,
    raw: ModelUpdate,
  )
  AudioUpdate(
    from_id: Int,
    chat_id: Int,
    audio: Audio,
    message: Message,
    raw: ModelUpdate,
  )
  VoiceUpdate(
    from_id: Int,
    chat_id: Int,
    voice: Voice,
    message: Message,
    raw: ModelUpdate,
  )
  WebAppUpdate(
    from_id: Int,
    chat_id: Int,
    web_app_data: WebAppData,
    message: Message,
    raw: ModelUpdate,
  )
  MessageUpdate(
    from_id: Int,
    chat_id: Int,
    message: Message,
    raw: ModelUpdate,
  )
  ChannelPostUpdate(
    from_id: Int,
    chat_id: Int,
    post: Message,
    raw: ModelUpdate,
  )
  EditedMessageUpdate(
    from_id: Int,
    chat_id: Int,
    message: Message,
    raw: ModelUpdate,
  )
  EditedChannelPostUpdate(
    from_id: Int,
    chat_id: Int,
    post: Message,
    raw: ModelUpdate,
  )
  BusinessConnectionUpdate(
    from_id: Int,
    chat_id: Int,
    business_connection: BusinessConnection,
    raw: ModelUpdate,
  )
  BusinessMessageUpdate(
    from_id: Int,
    chat_id: Int,
    message: Message,
    raw: ModelUpdate,
  )
  EditedBusinessMessageUpdate(
    from_id: Int,
    chat_id: Int,
    message: Message,
    raw: ModelUpdate,
  )
  DeletedBusinessMessageUpdate(
    from_id: Int,
    chat_id: Int,
    business_messages_deleted: BusinessMessagesDeleted,
    raw: ModelUpdate,
  )
  MessageReactionUpdate(
    from_id: Int,
    chat_id: Int,
    message_reaction_updated: MessageReactionUpdated,
    raw: ModelUpdate,
  )
  MessageReactionCountUpdate(
    from_id: Int,
    chat_id: Int,
    message_reaction_count_updated: MessageReactionCountUpdated,
    raw: ModelUpdate,
  )
  InlineQueryUpdate(
    from_id: Int,
    chat_id: Int,
    inline_query: InlineQuery,
    raw: ModelUpdate,
  )
  ChosenInlineResultUpdate(
    from_id: Int,
    chat_id: Int,
    chosen_inline_result: ChosenInlineResult,
    raw: ModelUpdate,
  )
  CallbackQueryUpdate(
    from_id: Int,
    chat_id: Int,
    query: CallbackQuery,
    raw: ModelUpdate,
  )
  ShippingQueryUpdate(
    from_id: Int,
    chat_id: Int,
    shipping_query: ShippingQuery,
    raw: ModelUpdate,
  )
  PreCheckoutQueryUpdate(
    from_id: Int,
    chat_id: Int,
    pre_checkout_query: PreCheckoutQuery,
    raw: ModelUpdate,
  )
  PaidMediaPurchaseUpdate(
    from_id: Int,
    chat_id: Int,
    paid_media_purchased: PaidMediaPurchased,
    raw: ModelUpdate,
  )
  PollUpdate(
    from_id: Int,
    chat_id: Int,
    poll: Poll,
    raw: ModelUpdate,
  )
  PollAnswerUpdate(
    from_id: Int,
    chat_id: Int,
    poll_answer: PollAnswer,
    raw: ModelUpdate,
  )
  MyChatMemberUpdate(
    from_id: Int,
    chat_id: Int,
    chat_member_updated: ChatMemberUpdated,
    raw: ModelUpdate,
  )
  ChatMemberUpdate(
    from_id: Int,
    chat_id: Int,
    chat_member_updated: ChatMemberUpdated,
    raw: ModelUpdate,
  )
  ChatJoinRequestUpdate(
    from_id: Int,
    chat_id: Int,
    chat_join_request: ChatJoinRequest,
    raw: ModelUpdate,
  )
  RemovedChatBoost(
    from_id: Int,
    chat_id: Int,
    removed_chat_boost: ChatBoostRemoved,
    raw: ModelUpdate,
  )
}

Constructors

  • TextUpdate(
      from_id: Int,
      chat_id: Int,
      text: String,
      message: Message,
      raw: ModelUpdate,
    )
  • CommandUpdate(
      from_id: Int,
      chat_id: Int,
      command: Command,
      message: Message,
      raw: ModelUpdate,
    )
  • PhotoUpdate(
      from_id: Int,
      chat_id: Int,
      photos: List(PhotoSize),
      message: Message,
      raw: ModelUpdate,
    )
  • VideoUpdate(
      from_id: Int,
      chat_id: Int,
      video: Video,
      message: Message,
      raw: ModelUpdate,
    )
  • AudioUpdate(
      from_id: Int,
      chat_id: Int,
      audio: Audio,
      message: Message,
      raw: ModelUpdate,
    )
  • VoiceUpdate(
      from_id: Int,
      chat_id: Int,
      voice: Voice,
      message: Message,
      raw: ModelUpdate,
    )
  • WebAppUpdate(
      from_id: Int,
      chat_id: Int,
      web_app_data: WebAppData,
      message: Message,
      raw: ModelUpdate,
    )
  • MessageUpdate(
      from_id: Int,
      chat_id: Int,
      message: Message,
      raw: ModelUpdate,
    )
  • ChannelPostUpdate(
      from_id: Int,
      chat_id: Int,
      post: Message,
      raw: ModelUpdate,
    )
  • EditedMessageUpdate(
      from_id: Int,
      chat_id: Int,
      message: Message,
      raw: ModelUpdate,
    )
  • EditedChannelPostUpdate(
      from_id: Int,
      chat_id: Int,
      post: Message,
      raw: ModelUpdate,
    )
  • BusinessConnectionUpdate(
      from_id: Int,
      chat_id: Int,
      business_connection: BusinessConnection,
      raw: ModelUpdate,
    )
  • BusinessMessageUpdate(
      from_id: Int,
      chat_id: Int,
      message: Message,
      raw: ModelUpdate,
    )
  • EditedBusinessMessageUpdate(
      from_id: Int,
      chat_id: Int,
      message: Message,
      raw: ModelUpdate,
    )
  • DeletedBusinessMessageUpdate(
      from_id: Int,
      chat_id: Int,
      business_messages_deleted: BusinessMessagesDeleted,
      raw: ModelUpdate,
    )
  • MessageReactionUpdate(
      from_id: Int,
      chat_id: Int,
      message_reaction_updated: MessageReactionUpdated,
      raw: ModelUpdate,
    )
  • MessageReactionCountUpdate(
      from_id: Int,
      chat_id: Int,
      message_reaction_count_updated: MessageReactionCountUpdated,
      raw: ModelUpdate,
    )
  • InlineQueryUpdate(
      from_id: Int,
      chat_id: Int,
      inline_query: InlineQuery,
      raw: ModelUpdate,
    )
  • ChosenInlineResultUpdate(
      from_id: Int,
      chat_id: Int,
      chosen_inline_result: ChosenInlineResult,
      raw: ModelUpdate,
    )
  • CallbackQueryUpdate(
      from_id: Int,
      chat_id: Int,
      query: CallbackQuery,
      raw: ModelUpdate,
    )
  • ShippingQueryUpdate(
      from_id: Int,
      chat_id: Int,
      shipping_query: ShippingQuery,
      raw: ModelUpdate,
    )
  • PreCheckoutQueryUpdate(
      from_id: Int,
      chat_id: Int,
      pre_checkout_query: PreCheckoutQuery,
      raw: ModelUpdate,
    )
  • PaidMediaPurchaseUpdate(
      from_id: Int,
      chat_id: Int,
      paid_media_purchased: PaidMediaPurchased,
      raw: ModelUpdate,
    )
  • PollUpdate(
      from_id: Int,
      chat_id: Int,
      poll: Poll,
      raw: ModelUpdate,
    )
  • PollAnswerUpdate(
      from_id: Int,
      chat_id: Int,
      poll_answer: PollAnswer,
      raw: ModelUpdate,
    )
  • MyChatMemberUpdate(
      from_id: Int,
      chat_id: Int,
      chat_member_updated: ChatMemberUpdated,
      raw: ModelUpdate,
    )
  • ChatMemberUpdate(
      from_id: Int,
      chat_id: Int,
      chat_member_updated: ChatMemberUpdated,
      raw: ModelUpdate,
    )
  • ChatJoinRequestUpdate(
      from_id: Int,
      chat_id: Int,
      chat_join_request: ChatJoinRequest,
      raw: ModelUpdate,
    )
  • RemovedChatBoost(
      from_id: Int,
      chat_id: Int,
      removed_chat_boost: ChatBoostRemoved,
      raw: ModelUpdate,
    )

Values

pub fn decode_raw(json: Dynamic) -> Result(Update, TelegaError)
pub fn raw_to_update(raw_update: Update) -> telega/update.Update

Decode a update from the Telegram API to Update instance.

pub fn to_string(update: Update) -> String
Search Document