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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      @Nullable 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 @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

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

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

      @Nullable 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 @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

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

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

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

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

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

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

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

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

      @Nullable 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 @Nullable List<MessageEntity> entities)
      Parameters:
      entities - For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
    • getCaptionEntities

      @Nullable 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 @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

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

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

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

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

      @Nullable 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 @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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      @Nullable 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 @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

      @Nullable 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 @Nullable User leftChatMember)
      Parameters:
      leftChatMember - A member was removed from the group, information about them (this member may be the bot itself).
    • getNewChatTitle

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      @Nullable 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 @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

      @Nullable 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 @Nullable Boolean automaticForward)
      Parameters:
      automaticForward - True, if the message is a channel post that was automatically forwarded to the connected discussion group
    • getViaBot

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public String toString()
      Overrides:
      toString in class Object