forked from pengrad/java-telegram-bot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessage.java
More file actions
676 lines (579 loc) · 23.3 KB
/
Message.java
File metadata and controls
676 lines (579 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
package com.pengrad.telegrambot.model;
import com.pengrad.telegrambot.model.chatbackground.ChatBackground;
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
import com.pengrad.telegrambot.model.gift.GiftInfo;
import com.pengrad.telegrambot.model.gift.unique.UniqueGiftInfo;
import com.pengrad.telegrambot.model.giveaway.Giveaway;
import com.pengrad.telegrambot.model.giveaway.GiveawayCompleted;
import com.pengrad.telegrambot.model.giveaway.GiveawayCreated;
import com.pengrad.telegrambot.model.giveaway.GiveawayWinners;
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
import com.pengrad.telegrambot.model.message.origin.*;
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
import com.pengrad.telegrambot.passport.PassportData;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
/**
* stas
* 8/4/15.
*/
public class Message extends MaybeInaccessibleMessage implements Serializable {
private final static long serialVersionUID = 0L;
private Integer message_thread_id;
private User from;
private Chat sender_chat;
private Integer sender_boost_count;
private User sender_business_bot;
private String business_connection_id;
private MessageOrigin forward_origin;
private Boolean is_topic_message;
private Boolean is_automatic_forward;
private Message reply_to_message;
private ExternalReplyInfo external_reply;
private TextQuote quote;
private Story reply_to_story;
private User via_bot;
private Integer edit_date;
private Boolean has_protected_content;
private Boolean is_from_offline;
private Boolean has_media_spoiler;
private String media_group_id;
private String author_signature;
private String text;
private MessageEntity[] entities;
private MessageEntity[] caption_entities;
private Boolean show_caption_above_media;
private LinkPreviewOptions link_preview_options;
private String effect_id;
private Audio audio;
private PaidMediaInfo paid_media;
private Document document;
private Animation animation;
private Game game;
private PhotoSize[] photo;
private Sticker sticker;
private Video video;
private Voice voice;
private VideoNote video_note;
private String caption;
private Contact contact;
private Location location;
private Venue venue;
private Poll poll;
private Dice dice;
private User[] new_chat_members;
private User left_chat_member;
private String new_chat_title;
private PhotoSize[] new_chat_photo;
private Boolean delete_chat_photo;
private Boolean group_chat_created;
private Boolean supergroup_chat_created;
private Boolean channel_chat_created;
private MessageAutoDeleteTimerChanged message_auto_delete_timer_changed;
private Long migrate_to_chat_id;
private Long migrate_from_chat_id;
private MaybeInaccessibleMessage pinned_message;
private Invoice invoice;
private SuccessfulPayment successful_payment;
private RefundedPayment refunded_payment;
private Story story;
private UsersShared users_shared;
private ChatShared chat_shared;
private String connected_website;
private PassportData passport_data;
private ProximityAlertTriggered proximity_alert_triggered;
private ChatBoostAdded boost_added;
private ChatBackground chat_background_set;
private ForumTopicCreated forum_topic_created;
private ForumTopicEdited forum_topic_edited;
private ForumTopicClosed forum_topic_closed;
private ForumTopicReopened forum_topic_reopened;
private GeneralForumTopicHidden general_forum_topic_hidden;
private GeneralForumTopicUnhidden general_forum_topic_unhidden;
private GiveawayCreated giveaway_created;
private Giveaway giveaway;
private GiveawayWinners giveaway_winners;
private GiveawayCompleted giveaway_completed;
private WriteAccessAllowed write_access_allowed;
private VideoChatStarted video_chat_started;
private VideoChatEnded video_chat_ended;
private VideoChatParticipantsInvited video_chat_participants_invited;
private VideoChatScheduled video_chat_scheduled;
private InlineKeyboardMarkup reply_markup;
private WebAppData web_app_data;
private GiftInfo gift;
private UniqueGiftInfo unique_gift;
private PaidMessagePriceChanged paid_message_price_changed;
private Integer paid_star_count;
public Integer messageThreadId() {
return message_thread_id;
}
public User from() {
return from;
}
public Chat senderChat() {
return sender_chat;
}
public Integer senderBoostCount() {
return sender_boost_count;
}
public User senderBusinessBot() {
return sender_business_bot;
}
public String businessConnectionId() {
return business_connection_id;
}
public MessageOrigin forwardOrigin() {
return forward_origin;
}
public Boolean isTopicMessage() {
return is_topic_message != null && is_topic_message;
}
public Boolean isAutomaticForward() {
return is_automatic_forward;
}
public Message replyToMessage() {
return reply_to_message;
}
public ExternalReplyInfo externalReply() {
return external_reply;
}
public TextQuote quote() {
return quote;
}
public Story replyToStory() {
return reply_to_story;
}
public User viaBot() {
return via_bot;
}
public Integer editDate() {
return edit_date;
}
public Boolean hasProtectedContent() {
return has_protected_content != null && has_protected_content;
}
public Boolean isFromOffline() {
return is_from_offline != null && is_from_offline;
}
public Boolean hasMediaSpoiler() {
return has_media_spoiler != null && has_media_spoiler;
}
public String mediaGroupId() {
return media_group_id;
}
public String authorSignature() {
return author_signature;
}
public String text() {
return text;
}
public MessageEntity[] entities() {
return entities;
}
public MessageEntity[] captionEntities() {
return caption_entities;
}
public Boolean showCaptionAboveMedia() {
return show_caption_above_media;
}
public LinkPreviewOptions linkPreviewOptions() {
return link_preview_options;
}
public String effectId() {
return effect_id;
}
public Audio audio() {
return audio;
}
public PaidMediaInfo paidMedia() {
return paid_media;
}
public Document document() {
return document;
}
public Animation animation() {
return animation;
}
public Game game() {
return game;
}
public PhotoSize[] photo() {
return photo;
}
public Sticker sticker() {
return sticker;
}
public Video video() {
return video;
}
public Voice voice() {
return voice;
}
public VideoNote videoNote() {
return video_note;
}
public String caption() {
return caption;
}
public Contact contact() {
return contact;
}
public Location location() {
return location;
}
public Venue venue() {
return venue;
}
public Poll poll() {
return poll;
}
public Dice dice() {
return dice;
}
public User[] newChatMembers() {
return new_chat_members;
}
public User leftChatMember() {
return left_chat_member;
}
public String newChatTitle() {
return new_chat_title;
}
public PhotoSize[] newChatPhoto() {
return new_chat_photo;
}
public Boolean deleteChatPhoto() {
return delete_chat_photo;
}
public Boolean groupChatCreated() {
return group_chat_created;
}
public Boolean supergroupChatCreated() {
return supergroup_chat_created;
}
public Boolean channelChatCreated() {
return channel_chat_created;
}
public MessageAutoDeleteTimerChanged messageAutoDeleteTimerChanged() {
return message_auto_delete_timer_changed;
}
public Long migrateToChatId() {
return migrate_to_chat_id;
}
public Long migrateFromChatId() {
return migrate_from_chat_id;
}
public MaybeInaccessibleMessage pinnedMessage() {
return pinned_message;
}
public Invoice invoice() {
return invoice;
}
public SuccessfulPayment successfulPayment() {
return successful_payment;
}
public RefundedPayment refundedPayment() {
return refunded_payment;
}
public Story story() {
return story;
}
public UsersShared usersShared() {
return users_shared;
}
public ChatShared chatShared() {
return chat_shared;
}
public String connectedWebsite() {
return connected_website;
}
public PassportData passportData() {
return passport_data;
}
public ProximityAlertTriggered proximityAlertTriggered() {
return proximity_alert_triggered;
}
public ChatBoostAdded boostAdded() {
return boost_added;
}
public ChatBackground chatBackgroundSet() {
return chat_background_set;
}
public ForumTopicCreated forumTopicCreated() {
return forum_topic_created;
}
public ForumTopicEdited forumTopicEdited() {
return forum_topic_edited;
}
public ForumTopicClosed forumTopicClosed() {
return forum_topic_closed;
}
public ForumTopicReopened forumTopicReopened() {
return forum_topic_reopened;
}
public GeneralForumTopicHidden generalForumTopicHidden() {
return general_forum_topic_hidden;
}
public GeneralForumTopicUnhidden generalForumTopicUnhidden() {
return general_forum_topic_unhidden;
}
public GiveawayCreated giveawayCreated() {
return giveaway_created;
}
public Giveaway giveaway() {
return giveaway;
}
public GiveawayWinners giveawayWinners() {
return giveaway_winners;
}
public GiveawayCompleted giveawayCompleted() {
return giveaway_completed;
}
public WriteAccessAllowed writeAccessAllowed() {
return write_access_allowed;
}
public VideoChatStarted videoChatStarted() {
return video_chat_started;
}
public VideoChatEnded videoChatEnded() {
return video_chat_ended;
}
public VideoChatParticipantsInvited videoChatParticipantsInvited() {
return video_chat_participants_invited;
}
public VideoChatScheduled videoChatScheduled() {
return video_chat_scheduled;
}
public InlineKeyboardMarkup replyMarkup() {
return reply_markup;
}
public WebAppData webAppData() {
return web_app_data;
}
public GiftInfo gift() {
return gift;
}
public UniqueGiftInfo uniqueGift() {
return unique_gift;
}
public PaidMessagePriceChanged paidMessagePriceChanged() {
return paid_message_price_changed;
}
public Integer paidStarCount() {
return paid_star_count;
}
/**
* Only for backwards-compatibility with MaybeInaccessibleMessage
*/
void setChat(Chat chat) {
this.chat = chat;
}
/**
* Only for backwards-compatibility with MaybeInaccessibleMessage
*/
void setMessageId(Integer messageId) {
this.message_id = messageId;
}
/**
* Only for backwards-compatibility with MaybeInaccessibleMessage
*/
void setDate(Integer date) {
this.date = date;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
return Objects.equals(message_id, message.message_id) &&
Objects.equals(message_thread_id, message.message_thread_id) &&
Objects.equals(from, message.from) &&
Objects.equals(sender_chat, message.sender_chat) &&
Objects.equals(sender_boost_count, message.sender_boost_count) &&
Objects.equals(date, message.date) &&
Objects.equals(sender_business_bot, message.sender_business_bot) &&
Objects.equals(business_connection_id, message.business_connection_id) &&
Objects.equals(chat, message.chat) &&
Objects.equals(forward_origin, message.forward_origin) &&
Objects.equals(is_topic_message, message.is_topic_message) &&
Objects.equals(is_automatic_forward, message.is_automatic_forward) &&
Objects.equals(reply_to_message, message.reply_to_message) &&
Objects.equals(external_reply, message.external_reply) &&
Objects.equals(quote, message.quote) &&
Objects.equals(reply_to_story, message.reply_to_story) &&
Objects.equals(via_bot, message.via_bot) &&
Objects.equals(edit_date, message.edit_date) &&
Objects.equals(has_protected_content, message.has_protected_content) &&
Objects.equals(is_from_offline, message.is_from_offline) &&
Objects.equals(has_media_spoiler, message.has_media_spoiler) &&
Objects.equals(media_group_id, message.media_group_id) &&
Objects.equals(author_signature, message.author_signature) &&
Objects.equals(text, message.text) &&
Arrays.equals(entities, message.entities) &&
Arrays.equals(caption_entities, message.caption_entities) &&
Objects.equals(show_caption_above_media, message.show_caption_above_media) &&
Objects.equals(link_preview_options, message.link_preview_options) &&
Objects.equals(effect_id, message.effect_id) &&
Objects.equals(audio, message.audio) &&
Objects.equals(paid_media, message.paid_media) &&
Objects.equals(document, message.document) &&
Objects.equals(animation, message.animation) &&
Objects.equals(game, message.game) &&
Arrays.equals(photo, message.photo) &&
Objects.equals(sticker, message.sticker) &&
Objects.equals(video, message.video) &&
Objects.equals(voice, message.voice) &&
Objects.equals(video_note, message.video_note) &&
Objects.equals(caption, message.caption) &&
Objects.equals(contact, message.contact) &&
Objects.equals(location, message.location) &&
Objects.equals(venue, message.venue) &&
Objects.equals(poll, message.poll) &&
Objects.equals(dice, message.dice) &&
Arrays.equals(new_chat_members, message.new_chat_members) &&
Objects.equals(left_chat_member, message.left_chat_member) &&
Objects.equals(new_chat_title, message.new_chat_title) &&
Arrays.equals(new_chat_photo, message.new_chat_photo) &&
Objects.equals(delete_chat_photo, message.delete_chat_photo) &&
Objects.equals(group_chat_created, message.group_chat_created) &&
Objects.equals(supergroup_chat_created, message.supergroup_chat_created) &&
Objects.equals(channel_chat_created, message.channel_chat_created) &&
Objects.equals(message_auto_delete_timer_changed, message.message_auto_delete_timer_changed) &&
Objects.equals(migrate_to_chat_id, message.migrate_to_chat_id) &&
Objects.equals(migrate_from_chat_id, message.migrate_from_chat_id) &&
Objects.equals(pinned_message, message.pinned_message) &&
Objects.equals(invoice, message.invoice) &&
Objects.equals(successful_payment, message.successful_payment) &&
Objects.equals(refunded_payment, message.refunded_payment) &&
Objects.equals(story, message.story) &&
Objects.equals(users_shared, message.users_shared) &&
Objects.equals(chat_shared, message.chat_shared) &&
Objects.equals(connected_website, message.connected_website) &&
Objects.equals(passport_data, message.passport_data) &&
Objects.equals(proximity_alert_triggered, message.proximity_alert_triggered) &&
Objects.equals(boost_added, message.boost_added) &&
Objects.equals(chat_background_set, message.chat_background_set) &&
Objects.equals(forum_topic_created, message.forum_topic_created) &&
Objects.equals(forum_topic_edited, message.forum_topic_edited) &&
Objects.equals(forum_topic_closed, message.forum_topic_closed) &&
Objects.equals(forum_topic_reopened, message.forum_topic_reopened) &&
Objects.equals(general_forum_topic_hidden, message.general_forum_topic_hidden) &&
Objects.equals(general_forum_topic_unhidden, message.general_forum_topic_unhidden) &&
Objects.equals(giveaway_created, message.giveaway_created) &&
Objects.equals(giveaway, message.giveaway) &&
Objects.equals(giveaway_winners, message.giveaway_winners) &&
Objects.equals(giveaway_completed, message.giveaway_completed) &&
Objects.equals(write_access_allowed, message.write_access_allowed) &&
Objects.equals(video_chat_started, message.video_chat_started) &&
Objects.equals(video_chat_ended, message.video_chat_ended) &&
Objects.equals(video_chat_participants_invited, message.video_chat_participants_invited) &&
Objects.equals(video_chat_scheduled, message.video_chat_scheduled) &&
Objects.equals(reply_markup, message.reply_markup) &&
Objects.equals(web_app_data, message.web_app_data) &&
Objects.equals(gift, message.gift) &&
Objects.equals(unique_gift, message.unique_gift) &&
Objects.equals(paid_message_price_changed, message.paid_message_price_changed) &&
Objects.equals(paid_star_count, message.paid_star_count);
}
@Override
public int hashCode() {
return message_id != null ? message_id.hashCode() : 0;
}
@Override
public String toString() {
return "Message{" +
"message_id=" + message_id +
", message_thread_id=" + message_thread_id +
", from=" + from +
", sender_chat=" + sender_chat +
", sender_boost_count=" + sender_boost_count +
", date=" + date +
", sender_business_bot=" + sender_business_bot +
", business_connection_id=" + business_connection_id +
", chat=" + chat +
", forward_origin=" + forward_origin +
", is_topic_message=" + is_topic_message +
", is_automatic_forward=" + is_automatic_forward +
", reply_to_message=" + reply_to_message +
", external_reply=" + external_reply +
", quote=" + quote +
", reply_to_story=" + reply_to_story +
", via_bot=" + via_bot +
", edit_date=" + edit_date +
", has_protected_content=" + has_protected_content +
", is_from_offline=" + is_from_offline +
", has_media_spoiler=" + has_media_spoiler +
", media_group_id='" + media_group_id + '\'' +
", author_signature='" + author_signature + '\'' +
", text='" + text + '\'' +
", entities=" + Arrays.toString(entities) +
", caption_entities=" + Arrays.toString(caption_entities) +
", show_caption_above_media=" + show_caption_above_media +
", link_preview_options=" + link_preview_options +
", effect_id=" + effect_id +
", audio=" + audio +
", paid_media=" + paid_media +
", document=" + document +
", animation=" + animation +
", game=" + game +
", photo=" + Arrays.toString(photo) +
", sticker=" + sticker +
", video=" + video +
", voice=" + voice +
", video_note=" + video_note +
", caption='" + caption + '\'' +
", contact=" + contact +
", location=" + location +
", venue=" + venue +
", poll=" + poll +
", dice=" + dice +
", new_chat_members=" + Arrays.toString(new_chat_members) +
", left_chat_member=" + left_chat_member +
", new_chat_title='" + new_chat_title + '\'' +
", new_chat_photo=" + Arrays.toString(new_chat_photo) +
", delete_chat_photo=" + delete_chat_photo +
", group_chat_created=" + group_chat_created +
", supergroup_chat_created=" + supergroup_chat_created +
", channel_chat_created=" + channel_chat_created +
", message_auto_delete_timer_changed=" + message_auto_delete_timer_changed +
", migrate_to_chat_id=" + migrate_to_chat_id +
", migrate_from_chat_id=" + migrate_from_chat_id +
", pinned_message=" + pinned_message +
", invoice=" + invoice +
", successful_payment=" + successful_payment +
", refunded_payment=" + refunded_payment +
", story=" + story +
", users_shared=" + users_shared +
", chat_shared=" + chat_shared +
", connected_website='" + connected_website + '\'' +
", passport_data=" + passport_data +
", proximity_alert_triggered=" + proximity_alert_triggered +
", boost_added=" + boost_added +
", chat_background_set=" + chat_background_set +
", forum_topic_created=" + forum_topic_created +
", forum_topic_edited=" + forum_topic_edited +
", forum_topic_closed=" + forum_topic_closed +
", forum_topic_reopened=" + forum_topic_reopened +
", general_forum_topic_hidden=" + general_forum_topic_hidden +
", general_forum_topic_unhidden=" + general_forum_topic_unhidden +
", giveaway_created=" + giveaway_created +
", giveaway=" + giveaway +
", giveaway_winners=" + giveaway_winners +
", giveaway_completed=" + giveaway_completed +
", write_access_allowed=" + write_access_allowed +
", video_chat_started=" + video_chat_started +
", video_chat_ended=" + video_chat_ended +
", video_chat_participants_invited=" + video_chat_participants_invited +
", video_chat_scheduled=" + video_chat_scheduled +
", reply_markup=" + reply_markup +
", web_app_data=" + web_app_data +
", gift=" + gift +
", unique_gift=" + unique_gift +
", paid_message_price_changed=" + paid_message_price_changed +
", paid_star_count=" + paid_star_count +
'}';
}
}