TDLightTelegramBots/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java

719 lines
23 KiB
Java
Raw Normal View History

2018-07-08 01:41:21 +02:00
package org.telegram.telegrambots.meta.api.objects;
2016-01-14 01:14:53 +01:00
2020-10-31 18:43:32 +01:00
import com.fasterxml.jackson.annotation.JsonIgnore;
2016-01-14 01:14:53 +01:00
import com.fasterxml.jackson.annotation.JsonProperty;
2020-10-31 18:43:32 +01:00
import lombok.AllArgsConstructor;
2020-11-01 23:46:36 +01:00
import lombok.EqualsAndHashCode;
import lombok.Getter;
2020-10-31 18:43:32 +01:00
import lombok.NoArgsConstructor;
2020-11-01 23:46:36 +01:00
import lombok.Setter;
import lombok.ToString;
2018-07-08 01:41:21 +02:00
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
2022-11-08 19:33:50 +01:00
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicClosed;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicCreated;
import org.telegram.telegrambots.meta.api.objects.forum.ForumTopicReopened;
2018-07-27 00:27:26 +02:00
import org.telegram.telegrambots.meta.api.objects.games.Animation;
2018-07-08 01:41:21 +02:00
import org.telegram.telegrambots.meta.api.objects.games.Game;
2018-07-27 00:27:26 +02:00
import org.telegram.telegrambots.meta.api.objects.passport.PassportData;
2018-07-08 01:41:21 +02:00
import org.telegram.telegrambots.meta.api.objects.payments.Invoice;
import org.telegram.telegrambots.meta.api.objects.payments.SuccessfulPayment;
2019-05-17 21:31:09 +02:00
import org.telegram.telegrambots.meta.api.objects.polls.Poll;
2019-06-01 13:50:17 +02:00
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
2018-07-08 01:41:21 +02:00
import org.telegram.telegrambots.meta.api.objects.stickers.Sticker;
2022-04-17 21:40:17 +02:00
import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatEnded;
import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatParticipantsInvited;
import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatScheduled;
import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatStarted;
import org.telegram.telegrambots.meta.api.objects.webapp.WebAppData;
2016-01-14 01:14:53 +01:00
2019-04-03 03:18:53 +02:00
import java.util.ArrayList;
2016-01-14 01:14:53 +01:00
import java.util.List;
/**
* This object represents a message.
2016-01-14 01:14:53 +01:00
* @author Ruben Bermudez
* @version 1.0
*/
2020-11-01 23:46:36 +01:00
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
2020-10-31 18:43:32 +01:00
@NoArgsConstructor
@AllArgsConstructor
public class Message implements BotApiObject {
2016-04-11 02:53:53 +02:00
private static final String MESSAGEID_FIELD = "message_id";
2022-11-08 19:33:50 +01:00
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
2016-04-11 02:53:53 +02:00
private static final String FROM_FIELD = "from";
private static final String DATE_FIELD = "date";
private static final String CHAT_FIELD = "chat";
private static final String FORWARDFROM_FIELD = "forward_from";
2016-05-07 18:41:48 +02:00
private static final String FORWARDFROMCHAT_FIELD = "forward_from_chat";
2016-04-11 02:53:53 +02:00
private static final String FORWARDDATE_FIELD = "forward_date";
private static final String TEXT_FIELD = "text";
private static final String ENTITIES_FIELD = "entities";
2017-10-11 19:27:12 +02:00
private static final String CAPTIONENTITIES_FIELD = "caption_entities";
2016-04-11 02:53:53 +02:00
private static final String AUDIO_FIELD = "audio";
private static final String DOCUMENT_FIELD = "document";
private static final String PHOTO_FIELD = "photo";
private static final String STICKER_FIELD = "sticker";
private static final String VIDEO_FIELD = "video";
private static final String CONTACT_FIELD = "contact";
private static final String LOCATION_FIELD = "location";
private static final String VENUE_FIELD = "venue";
2018-07-27 00:27:26 +02:00
private static final String ANIMATION_FIELD = "animation";
2016-04-11 02:53:53 +02:00
private static final String PINNED_MESSAGE_FIELD = "pinned_message";
2017-03-27 00:49:08 +02:00
private static final String NEWCHATMEMBERS_FIELD = "new_chat_members";
2016-04-11 02:53:53 +02:00
private static final String LEFTCHATMEMBER_FIELD = "left_chat_member";
private static final String NEWCHATTITLE_FIELD = "new_chat_title";
private static final String NEWCHATPHOTO_FIELD = "new_chat_photo";
private static final String DELETECHATPHOTO_FIELD = "delete_chat_photo";
private static final String GROUPCHATCREATED_FIELD = "group_chat_created";
private static final String REPLYTOMESSAGE_FIELD = "reply_to_message";
private static final String VOICE_FIELD = "voice";
2016-05-19 19:25:52 +02:00
private static final String CAPTION_FIELD = "caption";
2016-04-11 02:53:53 +02:00
private static final String SUPERGROUPCREATED_FIELD = "supergroup_chat_created";
private static final String CHANNELCHATCREATED_FIELD = "channel_chat_created";
private static final String MIGRATETOCHAT_FIELD = "migrate_to_chat_id";
private static final String MIGRATEFROMCHAT_FIELD = "migrate_from_chat_id";
2016-05-22 11:42:04 +02:00
private static final String EDITDATE_FIELD = "edit_date";
2016-09-28 00:29:44 +02:00
private static final String GAME_FIELD = "game";
2016-11-21 01:28:09 +01:00
private static final String FORWARDFROMMESSAGEID_FIELD = "forward_from_message_id";
2017-03-27 00:49:08 +02:00
private static final String INVOICE_FIELD = "invoice";
private static final String SUCCESSFUL_PAYMENT_FIELD = "successful_payment";
2017-05-03 01:40:55 +02:00
private static final String VIDEO_NOTE_FIELD = "video_note";
2017-08-23 09:06:32 +02:00
private static final String AUTHORSIGNATURE_FIELD = "author_signature";
private static final String FORWARDSIGNATURE_FIELD = "forward_signature";
2017-11-17 15:47:22 +01:00
private static final String MEDIAGROUPID_FIELD = "media_group_id";
2018-02-14 20:36:22 +01:00
private static final String CONNECTEDWEBSITE_FIELD = "connected_website";
2018-07-27 00:27:26 +02:00
private static final String PASSPORTDATA_FIELD = "passport_data";
2019-04-08 02:43:46 +02:00
private static final String FORWARDSENDERNAME_FIELD = "forward_sender_name";
2019-05-17 21:31:09 +02:00
private static final String POLL_FIELD = "poll";
2019-06-01 13:50:17 +02:00
private static final String REPLY_MARKUP_FIELD = "reply_markup";
2020-04-01 10:10:13 +02:00
private static final String DICE_FIELD = "dice";
2020-06-04 23:18:36 +02:00
private static final String VIABOT_FIELD = "via_bot";
2020-11-01 23:46:36 +01:00
private static final String SENDERCHAT_FIELD = "sender_chat";
private static final String PROXIMITYALERTTRIGGERED_FIELD = "proximity_alert_triggered";
2021-04-16 02:25:39 +02:00
private static final String MESSAGEAUTODELETETIMERCHANGED_FIELD = "message_auto_delete_timer_changed";
2021-12-07 22:03:25 +01:00
private static final String ISAUTOMATICFORWARD_FIELD = "is_automatic_forward";
2022-02-26 21:03:10 +01:00
private static final String HASPROTECTEDCONTENT_FIELD = "has_protected_content";
2022-04-17 21:40:17 +02:00
private static final String WEBAPPDATA_FIELD = "web_app_data";
private static final String VIDEOCHATSCHEDULED_FIELD = "video_chat_scheduled";
private static final String VIDEOCHATSTARTED_FIELD = "video_chat_started";
private static final String VIDEOCHATENDED_FIELD = "video_chat_ended";
private static final String VIDEOCHATPARTICIPANTSINVITED_FIELD = "video_chat_participants_invited";
2022-11-08 19:33:50 +01:00
private static final String ISTOPICMESSAGE_FIELD = "is_topic_message";
private static final String FORUMTOPICCREATED_FIELD = "forum_topic_created";
private static final String FORUMTOPICCLOSED_FIELD = "forum_topic_closed";
private static final String FORUMTOPICREOPENED_FIELD = "forum_topic_reopened";
2016-09-28 00:29:44 +02:00
/**
* Integer Unique message identifier
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(MESSAGEID_FIELD)
private Integer messageId;
2022-11-08 19:33:50 +01:00
/**
* Optional.
* Unique identifier of a message thread or a forum topic to which the message belongs;
* for supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
/**
* Optional.
* Sender, can be empty for messages sent to channels
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(FROM_FIELD)
private User from;
/**
* Date the message was sent in Unix time
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(DATE_FIELD)
private Integer date;
/**
* Conversation the message belongs to
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(CHAT_FIELD)
private Chat chat;
/**
* Optional.
* For forwarded messages, sender of the original message
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(FORWARDFROM_FIELD)
private User forwardFrom;
2020-11-01 23:46:36 +01:00
/**
* Optional.
* For messages forwarded from channels or from anonymous administrators, information about the original sender chat
*/
2016-05-07 18:41:48 +02:00
@JsonProperty(FORWARDFROMCHAT_FIELD)
2020-11-01 23:46:36 +01:00
private Chat forwardFromChat;
/**
* Optional.
* For forwarded messages, date the original message was sent
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(FORWARDDATE_FIELD)
private Integer forwardDate;
/**
* Optional.
* For text messages, the actual UTF-8 text of the message
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(TEXT_FIELD)
private String text;
2016-04-11 02:53:53 +02:00
/**
* Optional.
* For text messages, special entities like usernames, URLs,
2016-04-11 02:53:53 +02:00
* bot commands, etc. that appear in the text
*/
@JsonProperty(ENTITIES_FIELD)
2016-04-11 02:53:53 +02:00
private List<MessageEntity> entities;
2017-10-11 19:27:12 +02:00
/**
* Optional.
* For messages with a caption, special entities like usernames,
2017-10-11 19:27:12 +02:00
* URLs, bot commands, etc. that appear in the caption
*/
@JsonProperty(CAPTIONENTITIES_FIELD)
private List<MessageEntity> captionEntities;
/**
* Optional.
* Message is an audio file, information about the file
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(AUDIO_FIELD)
private Audio audio;
/**
* Optional.
* Message is a general file, information about the file
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(DOCUMENT_FIELD)
private Document document;
/**
* Optional.
* Message is a photo, available sizes of the photo
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(PHOTO_FIELD)
private List<PhotoSize> photo;
/**
* Optional.
* Message is a sticker, information about the sticker
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(STICKER_FIELD)
private Sticker sticker;
/**
* Optional.
* Message is a video, information about the video
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(VIDEO_FIELD)
private Video video;
/**
* Optional.
* Message is a shared contact, information about the contact
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(CONTACT_FIELD)
private Contact contact;
/**
* Optional.
* Message is a shared location, information about the location
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(LOCATION_FIELD)
private Location location;
/**
* Optional.
* Message is a venue, information about the venue
*/
2016-04-11 02:53:53 +02:00
@JsonProperty(VENUE_FIELD)
private Venue venue;
2018-07-27 00:27:26 +02:00
/**
* Optional.
* Message is an animation, information about the animation.
2018-07-27 00:27:26 +02:00
* For backward compatibility, when this field is set, the document field will be also set
*/
@JsonProperty(ANIMATION_FIELD)
private Animation animation;
/**
* Optional.
* Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
*/
2016-04-11 02:53:53 +02:00
@JsonProperty(PINNED_MESSAGE_FIELD)
private Message pinnedMessage;
/**
* Optional.
* New members were added to the group or supergroup, information about them (the bot itself may be one of these members)
*/
2017-03-27 00:49:08 +02:00
@JsonProperty(NEWCHATMEMBERS_FIELD)
private List<User> newChatMembers;
/**
* Optional.
* A member was removed from the group, information about them (this member may be bot itself)
*/
2016-04-11 02:53:53 +02:00
@JsonProperty(LEFTCHATMEMBER_FIELD)
private User leftChatMember;
/**
* Optional.
* A chat title was changed to this value
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(NEWCHATTITLE_FIELD)
private String newChatTitle;
/**
* Optional.
* A chat photo was change to this value
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(NEWCHATPHOTO_FIELD)
private List<PhotoSize> newChatPhoto;
/**
* Optional.
* Informs that the chat photo was deleted
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(DELETECHATPHOTO_FIELD)
private Boolean deleteChatPhoto;
/**
* Optional.
* Informs that the group has been created
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(GROUPCHATCREATED_FIELD)
private Boolean groupchatCreated;
2016-01-14 01:14:53 +01:00
@JsonProperty(REPLYTOMESSAGE_FIELD)
private Message replyToMessage;
/**
* Optional.
* Message is a voice message, information about the file
*/
2016-01-14 01:14:53 +01:00
@JsonProperty(VOICE_FIELD)
private Voice voice;
/**
* Optional.
* Caption for the document, photo or video, 0-200 characters
*/
2016-05-19 19:25:52 +02:00
@JsonProperty(CAPTION_FIELD)
private String caption;
2016-05-31 19:08:56 +02:00
/**
* Optional. 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.
*/
@JsonProperty(SUPERGROUPCREATED_FIELD)
2016-05-31 19:08:56 +02:00
private Boolean superGroupCreated;
/**
* Optional. 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.
*/
@JsonProperty(CHANNELCHATCREATED_FIELD)
2016-05-31 19:08:56 +02:00
private Boolean channelChatCreated;
/**
* Optional. The group has been migrated to a supergroup with the specified identifier.
* This number may be greater than 32 bits and some programming languages
* may have difficulty/silent defects in interpreting it.
* But it smaller than 52 bits, so a signed 64 bit integer or double-precision
* float type are safe for storing this identifier.
*/
@JsonProperty(MIGRATETOCHAT_FIELD)
private Long migrateToChatId;
2016-05-31 19:08:56 +02:00
/**
* Optional. The supergroup has been migrated from a group with the specified identifier.
* This number may be greater than 32 bits and some programming languages
* may have difficulty/silent defects in interpreting it.
* But it smaller than 52 bits, so a signed 64 bit integer or double-precision
* float type are safe for storing this identifier.
*/
@JsonProperty(MIGRATEFROMCHAT_FIELD)
private Long migrateFromChatId;
/**
* Optional.
* Date the message was last edited in Unix time
*/
2016-05-22 11:42:04 +02:00
@JsonProperty(EDITDATE_FIELD)
private Integer editDate;
/**
* Optional.
* Message is a game, information about the game
*/
2016-09-28 00:29:44 +02:00
@JsonProperty(GAME_FIELD)
private Game game;
/**
* Optional.
* For forwarded channel posts, identifier of the original message in the channel
*/
2016-11-21 01:28:09 +01:00
@JsonProperty(FORWARDFROMMESSAGEID_FIELD)
private Integer forwardFromMessageId;
/**
* Optional.
* Message is an invoice for a payment, information about the invoice.
*/
2017-03-27 00:49:08 +02:00
@JsonProperty(INVOICE_FIELD)
private Invoice invoice;
/**
* Optional.
* Message is a service message about a successful payment, information about the payment.
*/
2017-03-27 00:49:08 +02:00
@JsonProperty(SUCCESSFUL_PAYMENT_FIELD)
private SuccessfulPayment successfulPayment;
/**
* Optional.
* Message is a video note, information about the video message
*/
2017-05-03 01:40:55 +02:00
@JsonProperty(VIDEO_NOTE_FIELD)
private VideoNote videoNote;
2020-11-01 23:46:36 +01:00
/**
* Optional.
* Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
*/
2017-08-23 09:06:32 +02:00
@JsonProperty(AUTHORSIGNATURE_FIELD)
2020-11-01 23:46:36 +01:00
private String authorSignature;
/**
* Optional.
* Post author signature for messages forwarded from channel chats
*/
2017-08-23 09:06:32 +02:00
@JsonProperty(FORWARDSIGNATURE_FIELD)
private String forwardSignature;
/**
* Optional.
* The unique identifier of a media message group this message belongs to
*/
2017-11-17 15:47:22 +01:00
@JsonProperty(MEDIAGROUPID_FIELD)
private String mediaGroupId;
/**
* Optional.
* The domain name of the website on which the user has logged in
*/
2018-02-14 20:36:22 +01:00
@JsonProperty(CONNECTEDWEBSITE_FIELD)
private String connectedWebsite;
/**
* Optional.
* Telegram Passport data
*/
2018-07-27 00:27:26 +02:00
@JsonProperty(PASSPORTDATA_FIELD)
private PassportData passportData;
/**
* Optional.
* Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
*/
2019-04-08 02:43:46 +02:00
@JsonProperty(FORWARDSENDERNAME_FIELD)
private String forwardSenderName;
/**
* Optional.
* Message is a native poll, information about the poll
*/
2019-05-17 21:31:09 +02:00
@JsonProperty(POLL_FIELD)
private Poll poll;
2019-06-01 13:50:17 +02:00
/**
* Inline keyboard attached to the message.
*
* @apiNote login_url buttons are represented as ordinary url buttons.
*/
@JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup;
/**
* Optional.
* Message is a dice with random value from 1 to 6
*/
2020-04-01 10:10:13 +02:00
@JsonProperty(DICE_FIELD)
private Dice dice;
/**
* Optional.
* Bot through which the message was sent
*/
2020-06-04 23:18:36 +02:00
@JsonProperty(VIABOT_FIELD)
private User viaBot;
2020-11-01 23:46:36 +01:00
/**
* Optional.
* Sender of the message, sent on behalf of a chat. The channel itself for channel messages.
* The supergroup itself for messages from anonymous group administrators.
* The linked channel for messages automatically forwarded to the discussion group
*/
@JsonProperty(SENDERCHAT_FIELD)
private Chat senderChat;
/**
* Optional.
* Service message.
* A user in the chat triggered another user's proximity alert while sharing Live Location.
*/
@JsonProperty(PROXIMITYALERTTRIGGERED_FIELD)
private ProximityAlertTriggered proximityAlertTriggered;
/**
* Optional.
* Service message: auto-delete timer settings changed in the chat
*/
2021-03-09 11:59:28 +01:00
@JsonProperty(MESSAGEAUTODELETETIMERCHANGED_FIELD)
private MessageAutoDeleteTimerChanged messageAutoDeleteTimerChanged;
2021-12-07 22:03:25 +01:00
/**
* Optional.
* True, if the message is a channel post that was automatically forwarded to the connected discussion group
*/
@JsonProperty(ISAUTOMATICFORWARD_FIELD)
2021-12-07 22:03:25 +01:00
private Boolean isAutomaticForward;
/**
* Optional.
* True, if the message can't be forwarded
*/
2022-02-26 21:03:10 +01:00
@JsonProperty(HASPROTECTEDCONTENT_FIELD)
private Boolean hasProtectedContent;
/**
* Optional.
* Service message: data sent by a web app
*/
2022-04-17 21:40:17 +02:00
@JsonProperty(WEBAPPDATA_FIELD)
private WebAppData webAppData;
/**
* Optional.
* Service message: video chat started
*/
2022-04-17 21:40:17 +02:00
@JsonProperty(VIDEOCHATSTARTED_FIELD)
private VideoChatStarted videoChatStarted;
/**
* Optional.
* Service message: video chat ended
*/
2022-04-17 21:40:17 +02:00
@JsonProperty(VIDEOCHATENDED_FIELD)
private VideoChatEnded videoChatEnded;
/**
* Optional.
* Service message: new participants invited to a video chat
*/
2022-04-17 21:40:17 +02:00
@JsonProperty(VIDEOCHATPARTICIPANTSINVITED_FIELD)
private VideoChatParticipantsInvited videoChatParticipantsInvited;
/**
* Optional.
* Service message: video chat scheduled
*/
2022-04-17 21:40:17 +02:00
@JsonProperty(VIDEOCHATSCHEDULED_FIELD)
2022-11-08 19:33:50 +01:00
private VideoChatScheduled videoChatScheduled;
/**
* Optional.
* True, if the message is sent to a forum topic
*/
@JsonProperty(ISTOPICMESSAGE_FIELD)
private Boolean isTopicMessage;
/**
* Optional.
* Service message: forum topic created
*/
@JsonProperty(FORUMTOPICCREATED_FIELD)
private ForumTopicCreated forumTopicCreated;
/**
* Optional.
* Service message: forum topic closed
*/
@JsonProperty(FORUMTOPICCLOSED_FIELD)
private ForumTopicClosed forumTopicClosed;
/**
* Optional.
* Service message: forum topic reopened
*/
@JsonProperty(FORUMTOPICREOPENED_FIELD)
private ForumTopicReopened forumTopicReopened;
2016-01-14 01:14:53 +01:00
2016-04-12 22:53:44 +02:00
public List<MessageEntity> getEntities() {
2017-04-21 23:45:26 +02:00
if (entities != null) {
entities.forEach(x -> x.computeText(text));
}
2016-04-12 22:53:44 +02:00
return entities;
}
2017-10-11 19:27:12 +02:00
public List<MessageEntity> getCaptionEntities() {
if (captionEntities != null) {
captionEntities.forEach(x -> x.computeText(caption));
}
return captionEntities;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2017-03-27 00:49:08 +02:00
public List<User> getNewChatMembers() {
2019-04-03 03:18:53 +02:00
return newChatMembers == null ? new ArrayList<>() : newChatMembers;
2016-01-14 01:14:53 +01:00
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean hasSticker() {
return sticker != null;
2016-11-21 01:28:09 +01:00
}
2022-11-08 19:33:50 +01:00
@JsonIgnore
public boolean isTopicMessage() {
return isTopicMessage != null && isTopicMessage;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean isGroupMessage() {
return chat.isGroupChat();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean isUserMessage() {
return chat.isUserChat();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean isChannelMessage() {
return chat.isChannelChat();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean isSuperGroupMessage() {
return chat.isSuperGroupChat();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public Long getChatId() {
return chat.getId();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean hasText() {
return text != null && !text.isEmpty();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean isCommand() {
2016-05-27 03:19:17 +02:00
if (hasText() && entities != null) {
for (MessageEntity entity : entities) {
2016-05-27 03:19:17 +02:00
if (entity != null && entity.getOffset() == 0 &&
EntityType.BOTCOMMAND.equals(entity.getType())) {
return true;
}
}
}
return false;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean hasDocument() {
return this.document != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2018-04-02 18:38:29 +02:00
public boolean hasVideo() {
return this.video != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean hasAudio(){
return this.audio != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean hasVoice(){
return this.voice != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean isReply() {
return this.replyToMessage != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-04-12 22:53:44 +02:00
public boolean hasLocation() {
return location != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-09-28 00:29:44 +02:00
private boolean hasGame() {
return game != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean hasEntities() {
return entities != null && !entities.isEmpty();
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
public boolean hasPhoto() {
return photo != null && !photo.isEmpty();
2016-01-14 01:14:53 +01:00
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2017-03-27 00:49:08 +02:00
public boolean hasInvoice() {
return invoice != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2017-03-27 00:49:08 +02:00
public boolean hasSuccessfulPayment() {
return successfulPayment != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2018-04-01 12:40:58 +02:00
public boolean hasContact() {
return contact != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2018-07-27 00:27:26 +02:00
public boolean hasVideoNote() {
return videoNote != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2018-07-27 00:27:26 +02:00
public boolean hasPassportData() {
return passportData != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2018-07-27 00:27:26 +02:00
public boolean hasAnimation() {
return animation != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2019-05-17 21:31:09 +02:00
public boolean hasPoll() {
return poll != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2020-04-01 10:10:13 +02:00
public boolean hasDice() {
return dice != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2020-06-04 23:18:36 +02:00
public boolean hasViaBot() {
return viaBot != null;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2019-06-01 13:50:17 +02:00
public boolean hasReplyMarkup() {
return replyMarkup != null;
}
2021-03-09 11:59:28 +01:00
@JsonIgnore
private boolean hasMessageAutoDeleteTimerChanged() {
return messageAutoDeleteTimerChanged != null;
}
@JsonIgnore
2022-04-17 21:40:17 +02:00
private boolean hasWebAppData() {
return webAppData != null;
}
@JsonIgnore
private boolean hasVideoChatStarted() {
return videoChatStarted != null;
2021-03-09 11:59:28 +01:00
}
@JsonIgnore
2022-04-17 21:40:17 +02:00
private boolean hasVideoChatEnded() {
return videoChatEnded != null;
2021-03-09 11:59:28 +01:00
}
2021-04-26 21:55:00 +02:00
@JsonIgnore
2022-04-17 21:40:17 +02:00
private boolean hasVideoChatScheduled() {
return videoChatScheduled != null;
2021-04-26 21:55:00 +02:00
}
2021-03-09 11:59:28 +01:00
@JsonIgnore
2022-04-17 21:40:17 +02:00
private boolean hasVideoChatParticipantsInvited() {
return videoChatParticipantsInvited != null;
2021-03-09 11:59:28 +01:00
}
2022-11-08 19:33:50 +01:00
@JsonIgnore
private boolean hasForumTopicCreated() {
return forumTopicCreated != null;
}
@JsonIgnore
private boolean hasForumTopicClosed() {
return forumTopicClosed != null;
}
@JsonIgnore
private boolean hasForumTopicReopened() {
return forumTopicReopened != null;
}
2016-01-14 01:14:53 +01:00
}