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

Constructors

Values

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

Decode a update from the Telegram API to Update instance.

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