telega/update

Types

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

Constructors

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

Constructors

Values

pub fn decode_raw(
  json: dynamic.Dynamic,
) -> Result(model.Update, error.TelegaError)
pub fn raw_to_update(raw_update: model.Update) -> Update

Decode a update from the Telegram API to Update instance.

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