telega/models/message

Types

pub type Chat {
  Chat(
    id: Int,
    username: Option(String),
    first_name: Option(String),
    last_name: Option(String),
    is_forum: Option(Bool),
  )
}

Constructors

  • Chat(
      id: Int,
      username: Option(String),
      first_name: Option(String),
      last_name: Option(String),
      is_forum: Option(Bool),
    )

    Official reference: https://core.telegram.org/bots/api#chat

    Arguments

    • id

      Unique identifier for this chat.

    • username

      Username, for private chats, supergroups and channels if available

    • first_name

      First name of the other party in a private chat

    • last_name

      Last name of the other party in a private chat

    • is_forum

      True, if the supergroup chat is a forum (has topics enabled)

Unique identifier for this chat. Username, for private chats, supergroups and channels if available First name of the other party in a private chat Last name of the other party in a private chat True, if the supergroup chat is a forum (has topics enabled)

pub type Message {
  Message(
    message_id: Int,
    message_thread_id: Option(Int),
    from: Option(User),
    sender_chat: Option(Chat),
    sender_boost_count: Option(Int),
    date: Int,
    chat: Chat,
    is_topic_message: Option(Bool),
    is_automatic_forward: Option(Bool),
    reply_to_message: Option(Message),
    via_bot: Option(User),
    edit_date: Option(Int),
    has_protected_content: Option(Bool),
    media_group_id: Option(String),
    author_signature: Option(String),
    text: Option(String),
    entities: Option(List(MessageEntity)),
    caption: Option(String),
    caption_entities: Option(List(MessageEntity)),
    has_media_spoiler: Option(Bool),
    new_chat_members: Option(List(User)),
    left_chat_member: Option(User),
    new_chat_title: Option(String),
    delete_chat_photo: Option(Bool),
    group_chat_created: Option(Bool),
    supergroup_chat_created: Option(Bool),
    channel_chat_created: Option(Bool),
    migrate_to_chat_id: Option(Int),
    migrate_from_chat_id: Option(Int),
    connected_website: Option(String),
    reply_markup: Option(InlineKeyboardMarkup),
  )
}

Constructors

  • Message(
      message_id: Int,
      message_thread_id: Option(Int),
      from: Option(User),
      sender_chat: Option(Chat),
      sender_boost_count: Option(Int),
      date: Int,
      chat: Chat,
      is_topic_message: Option(Bool),
      is_automatic_forward: Option(Bool),
      reply_to_message: Option(Message),
      via_bot: Option(User),
      edit_date: Option(Int),
      has_protected_content: Option(Bool),
      media_group_id: Option(String),
      author_signature: Option(String),
      text: Option(String),
      entities: Option(List(MessageEntity)),
      caption: Option(String),
      caption_entities: Option(List(MessageEntity)),
      has_media_spoiler: Option(Bool),
      new_chat_members: Option(List(User)),
      left_chat_member: Option(User),
      new_chat_title: Option(String),
      delete_chat_photo: Option(Bool),
      group_chat_created: Option(Bool),
      supergroup_chat_created: Option(Bool),
      channel_chat_created: Option(Bool),
      migrate_to_chat_id: Option(Int),
      migrate_from_chat_id: Option(Int),
      connected_website: Option(String),
      reply_markup: Option(InlineKeyboardMarkup),
    )

    Official reference: https://core.telegram.org/bots/api#message

    Arguments

    • message_id

      Unique message identifier inside this chat

    • message_thread_id

      Unique identifier of a message thread to which the message belongs; for supergroups only

    • from

      Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

    • sender_chat

      Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

    • sender_boost_count

      If the sender of the message boosted the chat, the number of boosts added by the user

    • date

      Date the message was sent in Unix time. It is always a positive number, representing a valid date.

    • chat

      Chat the message belongs to

    • is_topic_message

      True, if the message is sent to a forum topic

    • is_automatic_forward

      True, if the message is a channel post that was automatically forwarded to the connected discussion group

    • reply_to_message

      For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.

    • edit_date

      Date the message was last edited in Unix time

    • has_protected_content

      True, if the message can’t be forwarded

    • media_group_id

      The unique identifier of a media message group this message belongs to

    • author_signature

      Signature of the post author for messages in channels, or the custom title of an anonymous group administrator

    • text

      For text messages, the actual UTF-8 text of the message

    • entities

      For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text

    • caption_entities

      For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption

    • has_media_spoiler

      True, if the message media is covered by a spoiler animation

    • new_chat_members

      New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

    • left_chat_member

      A member was removed from the group, information about them (this member may be the bot itself)

    • new_chat_title

      A chat title was changed to this value

    • delete_chat_photo

      Service message: the chat photo was deleted

    • group_chat_created

      Service message: the group has been created

    • supergroup_chat_created

      Service message: the supergroup has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.

    • channel_chat_created

      Service message: the channel has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.

    • migrate_to_chat_id

      The group has been migrated to a supergroup with the specified identifier.

    • migrate_from_chat_id

      The supergroup has been migrated from a group with the specified identifier.

    • connected_website

      The domain name of the website on which the user has logged in. More about Telegram Login >>

    • reply_markup

      Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.

Functions

pub fn decode(
  json: Dynamic,
) -> Result(Message, List(DecodeError))
Search Document