Class Message

java.lang.Object
io.micronaut.chatbots.telegram.api.Message

public class Message extends Object
This object represents a message.
See Also:
  • Constructor Details

    • Message

      public Message()
  • Method Details

    • getMessageId

      public @NonNull Integer getMessageId()
      Returns:
      Unique message identifier inside this chat.
    • setMessageId

      public void setMessageId(@NonNull Integer messageId)
      Parameters:
      messageId - Unique message identifier inside this chat.
    • getFrom

      public @Nullable User getFrom()
      Returns:
      Sender, empty for messages sent to channels.
    • setFrom

      public void setFrom(@Nullable User from)
      Parameters:
      from - Sender, empty for messages sent to channels.
    • getDate

      public @NonNull Integer getDate()
      Returns:
      Date the message was sent in Unix time.
    • setDate

      public void setDate(@NonNull Integer date)
      Parameters:
      date - Date the message was sent in Unix time.
    • getChat

      public @NonNull Chat getChat()
      Returns:
      Conversation the message belongs to.
    • setChat

      public void setChat(@NonNull Chat chat)
      Parameters:
      chat - Conversation the message belongs to.
    • getForwardFrom

      public @Nullable User getForwardFrom()
      Returns:
      For forwarded messages, sender of the original message.
    • setForwardFrom

      public void setForwardFrom(@Nullable User forwardFrom)
      Parameters:
      forwardFrom - For forwarded messages, sender of the original message.
    • getForwardFromChat

      public @Nullable Chat getForwardFromChat()
      Returns:
      For messages forwarded from channels, information about the original channel.
    • setForwardFromChat

      public void setForwardFromChat(@Nullable Chat forwardFromChat)
      Parameters:
      forwardFromChat - For messages forwarded from channels, information about the original channel.
    • getForwardFromMessageId

      public @Nullable Integer getForwardFromMessageId()
      Returns:
      For messages forwarded from channels, identifier of the original message in the channel.
    • setForwardFromMessageId

      public void setForwardFromMessageId(@Nullable Integer forwardFromMessageId)
      Parameters:
      forwardFromMessageId - For messages forwarded from channels, identifier of the original message in the channel.
    • getForwardSignature

      public @Nullable String getForwardSignature()
      Returns:
      For messages forwarded from channels, signature of the post author if present.
    • setForwardSignature

      public void setForwardSignature(@Nullable String forwardSignature)
      Parameters:
      forwardSignature - For messages forwarded from channels, signature of the post author if present.
    • getForwardSenderName

      public @Nullable String getForwardSenderName()
      Returns:
      Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
    • setForwardSenderName

      public void setForwardSenderName(@Nullable String forwardSenderName)
      Parameters:
      forwardSenderName - Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
    • getForwardDate

      public @Nullable Integer getForwardDate()
      Returns:
      For forwarded messages, date the original message was sent in Unix time
    • setForwardDate

      public void setForwardDate(@Nullable Integer forwardDate)
      Parameters:
      forwardDate - For forwarded messages, date the original message was sent in Unix time
    • getReplyToMessage

      public @Nullable Message getReplyToMessage()
      Returns:
      For replies, 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.
    • setReplyToMessage

      public void setReplyToMessage(@Nullable Message replyToMessage)
      Parameters:
      replyToMessage - For replies, 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.
    • getEditDate

      public @Nullable Integer getEditDate()
      Returns:
      Date the message was last edited in Unix time.
    • setEditDate

      public void setEditDate(@Nullable Integer editDate)
      Parameters:
      editDate - Date the message was last edited in Unix time.
    • getMediaGroupId

      public @Nullable String getMediaGroupId()
      Returns:
      The unique identifier of a media message group this message belongs to.
    • setMediaGroupId

      public void setMediaGroupId(@Nullable String mediaGroupId)
      Parameters:
      mediaGroupId - The unique identifier of a media message group this message belongs to.
    • getAuthorSignature

      public @Nullable String getAuthorSignature()
      Returns:
      Signature of the post author for messages in channels.
    • setAuthorSignature

      public void setAuthorSignature(@Nullable String authorSignature)
      Parameters:
      authorSignature - Signature of the post author for messages in channels.
    • getText

      public @Nullable String getText()
      Returns:
      For text messages, the actual UTF-8 text of the message, 0-4096 characters.
    • setText

      public void setText(@Nullable String text)
      Parameters:
      text - For text messages, the actual UTF-8 text of the message, 0-4096 characters.
    • getEntities

      public @Nullable List<MessageEntity> getEntities()
      Returns:
      For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
    • setEntities

      public void setEntities(@Nullable List<MessageEntity> entities)
      Parameters:
      entities - For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
    • getCaptionEntities

      public @Nullable List<MessageEntity> getCaptionEntities()
      Returns:
      For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption.
    • setCaptionEntities

      public void setCaptionEntities(@Nullable List<MessageEntity> captionEntities)
      Parameters:
      captionEntities - For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption.
    • getAudio

      public @Nullable Audio getAudio()
      Returns:
      Message is an audio file, information about the file.
    • setAudio

      public void setAudio(@Nullable Audio audio)
      Parameters:
      audio - Message is an audio file, information about the file.
    • getDocument

      public @Nullable Document getDocument()
      Returns:
      Message is a general file, information about the file.
    • setDocument

      public void setDocument(@Nullable Document document)
      Parameters:
      document - Message is a general file, information about the file.
    • getAnimation

      public @Nullable Animation getAnimation()
      Returns:
      Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set.
    • setAnimation

      public void setAnimation(@Nullable Animation animation)
      Parameters:
      animation - Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set.
    • getGame

      public @Nullable Game getGame()
      Returns:
      Message is a game, information about the game.
    • setGame

      public void setGame(@Nullable Game game)
      Parameters:
      game - Message is a game, information about the game.
    • getPhoto

      public @Nullable List<PhotoSize> getPhoto()
      Returns:
      Message is a photo, available sizes of the photo
    • setPhoto

      public void setPhoto(@Nullable List<PhotoSize> photo)
      Parameters:
      photo - Message is a photo, available sizes of the photo
    • getSticker

      public @Nullable Sticker getSticker()
      Returns:
      Message is a sticker, information about the sticker.
    • setSticker

      public void setSticker(@Nullable Sticker sticker)
      Parameters:
      sticker - Message is a sticker, information about the sticker.
    • getVideo

      public @Nullable Video getVideo()
      Returns:
      Message is a video, information about the video.
    • setVideo

      public void setVideo(@Nullable Video video)
      Parameters:
      video - Message is a video, information about the video.
    • getVoice

      public @Nullable Voice getVoice()
      Returns:
      Message is a voice message, information about the file.
    • setVoice

      public void setVoice(@Nullable Voice voice)
      Parameters:
      voice - Message is a voice message, information about the file.
    • getVideoNote

      public @Nullable VideoNote getVideoNote()
      Returns:
      Message is a video note, information about the video message.
    • setVideoNote

      public void setVideoNote(@Nullable VideoNote videoNote)
      Parameters:
      videoNote - Message is a video note, information about the video message.
    • getCaption

      public @Nullable String getCaption()
      Returns:
      Caption for the animation, audio, document, photo, video or voice, 0-1024 characters.
    • setCaption

      public void setCaption(@Nullable String caption)
      Parameters:
      caption - Caption for the animation, audio, document, photo, video or voice, 0-1024 characters.
    • getContact

      public @Nullable Contact getContact()
      Returns:
      Message is a shared contact, information about the contact.
    • setContact

      public void setContact(@Nullable Contact contact)
      Parameters:
      contact - Message is a shared contact, information about the contact.
    • getLocation

      public @Nullable Location getLocation()
      Returns:
      Message is a shared location, information about the location.
    • setLocation

      public void setLocation(@Nullable Location location)
      Parameters:
      location - Message is a shared location, information about the location.
    • getVenue

      public @Nullable Venue getVenue()
      Returns:
      Message is a venue, information about the venue.
    • setVenue

      public void setVenue(@Nullable Venue venue)
      Parameters:
      venue - Message is a venue, information about the venue.
    • getPoll

      public @Nullable Poll getPoll()
      Returns:
      Message is a native poll, information about the poll.
    • setPoll

      public void setPoll(@Nullable Poll poll)
      Parameters:
      poll - Message is a native poll, information about the poll.
    • getNewChatMembers

      public @Nullable List<User> getNewChatMembers()
      Returns:
      New members that were added to the group or supergroup and information about them (the bot itself may be one of these members).
    • setNewChatMembers

      public void setNewChatMembers(@Nullable List<User> newChatMembers)
      Parameters:
      newChatMembers - New members that were added to the group or supergroup and information about them (the bot itself may be one of these members).
    • getLeftChatMember

      public @Nullable User getLeftChatMember()
      Returns:
      A member was removed from the group, information about them (this member may be the bot itself).
    • setLeftChatMember

      public void setLeftChatMember(@Nullable User leftChatMember)
      Parameters:
      leftChatMember - A member was removed from the group, information about them (this member may be the bot itself).
    • getNewChatTitle

      public @Nullable String getNewChatTitle()
      Returns:
      A chat title was changed to this value.
    • setNewChatTitle

      public void setNewChatTitle(@Nullable String newChatTitle)
      Parameters:
      newChatTitle - A chat title was changed to this value.
    • getNewChatPhoto

      public @Nullable List<PhotoSize> getNewChatPhoto()
      Returns:
      A chat photo was change to this value.
    • setNewChatPhoto

      public void setNewChatPhoto(@Nullable List<PhotoSize> newChatPhoto)
      Parameters:
      newChatPhoto - A chat photo was change to this value.
    • getDeleteChatPhoto

      public @Nullable Boolean getDeleteChatPhoto()
      Returns:
      Service message: the chat photo was deleted.
    • setDeleteChatPhoto

      public void setDeleteChatPhoto(@Nullable Boolean deleteChatPhoto)
      Parameters:
      deleteChatPhoto - Service message: the chat photo was deleted.
    • getGroupChatCreated

      public @Nullable Boolean getGroupChatCreated()
      Returns:
      Service message: the group has been created.
    • setGroupChatCreated

      public void setGroupChatCreated(@Nullable Boolean groupChatCreated)
      Parameters:
      groupChatCreated - Service message: the group has been created.
    • getSupergroupChatCreated

      public @Nullable Boolean getSupergroupChatCreated()
      Returns:
      if the supergroup has been created.
    • setSupergroupChatCreated

      public void setSupergroupChatCreated(@Nullable Boolean supergroupChatCreated)
      Parameters:
      supergroupChatCreated - if the supergroup has been created.
    • getChannelChatCreated

      public @Nullable Boolean getChannelChatCreated()
      Returns:
      the channel has been created
    • setChannelChatCreated

      public void setChannelChatCreated(@Nullable Boolean channelChatCreated)
      Parameters:
      channelChatCreated - the channel has been created
    • getMigrateToChatId

      public @Nullable Long getMigrateToChatId()
      Returns:
      The group has been migrated to a supergroup with the specified identifier.
    • setMigrateToChatId

      public void setMigrateToChatId(@Nullable Long migrateToChatId)
      Parameters:
      migrateToChatId - The group has been migrated to a supergroup with the specified identifier.
    • getMigrateFromChatId

      public @Nullable Long getMigrateFromChatId()
      Returns:
      The supergroup has been migrated from a group with the specified identifier.
    • setMigrateFromChatId

      public void setMigrateFromChatId(@Nullable Long migrateFromChatId)
      Parameters:
      migrateFromChatId - The supergroup has been migrated from a group with the specified identifier.
    • getPinnedMessage

      public @Nullable Message getPinnedMessage()
      Returns:
      Specified message was pinned.
    • setPinnedMessage

      public void setPinnedMessage(@Nullable Message pinnedMessage)
      Parameters:
      pinnedMessage - Specified message was pinned.
    • getInvoice

      public @Nullable Invoice getInvoice()
      Returns:
      Message is an invoice for a payment, information about the invoice.
    • setInvoice

      public void setInvoice(@Nullable Invoice invoice)
      Parameters:
      invoice - Message is an invoice for a payment, information about the invoice.
    • getSuccessfulPayment

      public @Nullable SuccessfulPayment getSuccessfulPayment()
      Returns:
      Message is a service message about a successful payment, information about the payment.
    • setSuccessfulPayment

      public void setSuccessfulPayment(@Nullable SuccessfulPayment successfulPayment)
      Parameters:
      successfulPayment - Message is a service message about a successful payment, information about the payment.
    • getConnectedWebsite

      public @Nullable String getConnectedWebsite()
      Returns:
      The domain name of the website on which the user has logged in.
    • setConnectedWebsite

      public void setConnectedWebsite(@Nullable String connectedWebsite)
      Parameters:
      connectedWebsite - The domain name of the website on which the user has logged in.
    • getPassportData

      public @Nullable PassportData getPassportData()
      Returns:
      Telegram Passport data.
    • setPassportData

      public void setPassportData(@Nullable PassportData passportData)
      Parameters:
      passportData - Telegram Passport data.
    • getReplyMarkup

      public @Nullable InlineKeyboardMarkup getReplyMarkup()
      Returns:
      Inline keyboard attached to the message.
    • setReplyMarkup

      public void setReplyMarkup(@Nullable InlineKeyboardMarkup replyMarkup)
      Parameters:
      replyMarkup - Inline keyboard attached to the message.
    • getSenderChat

      public @Nullable Chat getSenderChat()
      Returns:
      Optional. 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.
    • setSenderChat

      public void setSenderChat(@Nullable Chat senderChat)
      Parameters:
      senderChat - Optional. 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.
    • isAutomaticForward

      public @Nullable Boolean isAutomaticForward()
      Returns:
      True, if the message is a channel post that was automatically forwarded to the connected discussion group
    • setAutomaticForward

      public void setAutomaticForward(@Nullable Boolean automaticForward)
      Parameters:
      automaticForward - True, if the message is a channel post that was automatically forwarded to the connected discussion group
    • getViaBot

      public @Nullable User getViaBot()
      Returns:
      Bot through which the message was sent.
    • setViaBot

      public void setViaBot(@Nullable User viaBot)
      Parameters:
      viaBot - Bot through which the message was sent.
    • getHasProtectedContent

      public @Nullable Boolean getHasProtectedContent()
      Returns:
      True, if the message can't be forwarded
    • setHasProtectedContent

      public void setHasProtectedContent(@Nullable Boolean hasProtectedContent)
      Parameters:
      hasProtectedContent - True, if the message can't be forwarded
    • getDice

      public @Nullable Dice getDice()
      Returns:
      Message is a dice with random value
    • setDice

      public void setDice(@Nullable Dice dice)
      Parameters:
      dice - Message is a dice with random value
    • getMessageAutoDeleteTimerChanged

      public @Nullable MessageAutoDeleteTimerChanged getMessageAutoDeleteTimerChanged()
      Returns:
      Service message: auto-delete timer settings changed in the chat.
    • setMessageAutoDeleteTimerChanged

      public void setMessageAutoDeleteTimerChanged(@Nullable MessageAutoDeleteTimerChanged messageAutoDeleteTimerChanged)
      Parameters:
      messageAutoDeleteTimerChanged - Service message: auto-delete timer settings changed in the chat.
    • getVideoChatScheduled

      public @Nullable VideoChatScheduled getVideoChatScheduled()
      Returns:
      Service message: video chat scheduled
    • setVideoChatScheduled

      public void setVideoChatScheduled(@Nullable VideoChatScheduled videoChatScheduled)
      Parameters:
      videoChatScheduled - Service message: video chat scheduled
    • getVideoChatStarted

      public @Nullable VideoChatStarted getVideoChatStarted()
      Returns:
      Service message: video chat started
    • setVideoChatStarted

      public void setVideoChatStarted(@Nullable VideoChatStarted videoChatStarted)
      Parameters:
      videoChatStarted - Service message: video chat started
    • getVideoChatEnded

      public @Nullable VideoChatEnded getVideoChatEnded()
      Returns:
      Service message: video chat ended
    • setVideoChatEnded

      public void setVideoChatEnded(@Nullable VideoChatEnded videoChatEnded)
      Parameters:
      videoChatEnded - Service message: video chat ended
    • getVideoChatParticipantsInvited

      public @Nullable VideoChatParticipantsInvited getVideoChatParticipantsInvited()
      Returns:
      Service message: new participants invited to a video chat
    • setVideoChatParticipantsInvited

      public void setVideoChatParticipantsInvited(@Nullable VideoChatParticipantsInvited videoChatParticipantsInvited)
      Parameters:
      videoChatParticipantsInvited - Service message: new participants invited to a video chat
    • getWebAppData

      public @Nullable WebAppData getWebAppData()
      Returns:
      Service message: data sent by a Web App
    • setWebAppData

      public void setWebAppData(@Nullable WebAppData webAppData)
      Parameters:
      webAppData - Service message: data sent by a Web App
    • toString

      public String toString()
      Overrides:
      toString in class Object