-
Notifications
You must be signed in to change notification settings - Fork 26
/
types.go
1766 lines (1544 loc) · 74.8 KB
/
types.go
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
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Echotron
* Copyright (C) 2018 The Echotron Contributors
*
* Echotron is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Echotron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package echotron
import "encoding/json"
// Update represents an incoming update.
// At most one of the optional parameters can be present in any given update.
type Update struct {
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
Message *Message `json:"message,omitempty"`
EditedMessage *Message `json:"edited_message,omitempty"`
ChannelPost *Message `json:"channel_post,omitempty"`
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
BusinessMessage *Message `json:"business_message,omitempty"`
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
Poll *Poll `json:"poll,omitempty"`
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
ID int `json:"update_id"`
}
// ChatID returns the ID of the chat the update is coming from.
func (u Update) ChatID() int64 {
switch {
case u.ChatJoinRequest != nil:
return u.ChatJoinRequest.Chat.ID
case u.ChatBoost != nil:
return u.ChatBoost.Chat.ID
case u.RemovedChatBoost != nil:
return u.RemovedChatBoost.Chat.ID
case u.Message != nil:
return u.Message.Chat.ID
case u.EditedMessage != nil:
return u.EditedMessage.Chat.ID
case u.ChannelPost != nil:
return u.ChannelPost.Chat.ID
case u.EditedChannelPost != nil:
return u.EditedChannelPost.Chat.ID
case u.BusinessConnection != nil:
return u.BusinessConnection.User.ID
case u.BusinessMessage != nil:
return u.BusinessMessage.Chat.ID
case u.EditedBusinessMessage != nil:
return u.EditedBusinessMessage.Chat.ID
case u.DeletedBusinessMessages != nil:
return u.DeletedBusinessMessages.Chat.ID
case u.MessageReaction != nil:
return u.MessageReaction.Chat.ID
case u.MessageReactionCount != nil:
return u.MessageReactionCount.Chat.ID
case u.InlineQuery != nil:
return u.InlineQuery.From.ID
case u.ChosenInlineResult != nil:
return u.ChosenInlineResult.From.ID
case u.CallbackQuery != nil:
return u.CallbackQuery.Message.Chat.ID
case u.ShippingQuery != nil:
return u.ShippingQuery.From.ID
case u.PreCheckoutQuery != nil:
return u.PreCheckoutQuery.From.ID
case u.PollAnswer != nil:
return u.PollAnswer.User.ID
case u.MyChatMember != nil:
return u.MyChatMember.Chat.ID
case u.ChatMember != nil:
return u.ChatMember.Chat.ID
default:
return 0
}
}
// WebhookInfo contains information about the current status of a webhook.
type WebhookInfo struct {
URL string `json:"url"`
IPAddress string `json:"ip_address,omitempty"`
LastErrorMessage string `json:"last_error_message,omitempty"`
AllowedUpdates []*UpdateType `json:"allowed_updates,omitempty"`
MaxConnections int `json:"max_connections,omitempty"`
LastErrorDate int64 `json:"last_error_date,omitempty"`
LastSynchronizationErrorDate int64 `json:"last_synchronization_error_date,omitempty"`
PendingUpdateCount int `json:"pending_update_count"`
HasCustomCertificate bool `json:"has_custom_certificate"`
}
// APIResponse is implemented by all the APIResponse* types.
type APIResponse interface {
// Base returns the object of type APIResponseBase contained in each implemented type.
Base() APIResponseBase
}
// APIResponseBase is a base type that represents the incoming response from Telegram servers.
// Used by APIResponse* to slim down the implementation.
type APIResponseBase struct {
Description string `json:"description,omitempty"`
ErrorCode int `json:"error_code,omitempty"`
Ok bool `json:"ok"`
}
// Base returns the APIResponseBase itself.
func (a APIResponseBase) Base() APIResponseBase {
return a
}
// APIResponseUpdate represents the incoming response from Telegram servers.
// Used by all methods that return an array of Update objects on success.
type APIResponseUpdate struct {
Result []*Update `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseUpdate) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseUser represents the incoming response from Telegram servers.
// Used by all methods that return a User object on success.
type APIResponseUser struct {
Result *User `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseUser) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseMessage represents the incoming response from Telegram servers.
// Used by all methods that return a Message object on success.
type APIResponseMessage struct {
Result *Message `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseMessage) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseMessageArray represents the incoming response from Telegram servers.
// Used by all methods that return an array of Message objects on success.
type APIResponseMessageArray struct {
Result []*Message `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseMessageArray) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseMessageID represents the incoming response from Telegram servers.
// Used by all methods that return a MessageID object on success.
type APIResponseMessageID struct {
Result *MessageID `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseMessageID) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseMessageIDs represents the incoming response from Telegram servers.
// Used by all methods that return a MessageID object on success.
type APIResponseMessageIDs struct {
Result []*MessageID `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseMessageIDs) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseCommands represents the incoming response from Telegram servers.
// Used by all methods that return an array of BotCommand objects on success.
type APIResponseCommands struct {
Result []*BotCommand `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseCommands) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseBool represents the incoming response from Telegram servers.
// Used by all methods that return True on success.
type APIResponseBool struct {
APIResponseBase
Result bool `json:"result,omitempty"`
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseBool) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseString represents the incoming response from Telegram servers.
// Used by all methods that return a string on success.
type APIResponseString struct {
Result string `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseString) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseChat represents the incoming response from Telegram servers.
// Used by all methods that return a ChatFullInfo object on success.
type APIResponseChat struct {
Result *ChatFullInfo `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseChat) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseInviteLink represents the incoming response from Telegram servers.
// Used by all methods that return a ChatInviteLink object on success.
type APIResponseInviteLink struct {
Result *ChatInviteLink `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseInviteLink) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseStickers represents the incoming response from Telegram servers.
// Used by all methods that return an array of Stickers on success.
type APIResponseStickers struct {
Result []*Sticker `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseStickers) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseStickerSet represents the incoming response from Telegram servers.
// Used by all methods that return a StickerSet object on success.
type APIResponseStickerSet struct {
Result *StickerSet `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseStickerSet) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseUserProfile represents the incoming response from Telegram servers.
// Used by all methods that return a UserProfilePhotos object on success.
type APIResponseUserProfile struct {
Result *UserProfilePhotos `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseUserProfile) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseFile represents the incoming response from Telegram servers.
// Used by all methods that return a File object on success.
type APIResponseFile struct {
Result *File `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseFile) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseAdministrators represents the incoming response from Telegram servers.
// Used by all methods that return an array of ChatMember objects on success.
type APIResponseAdministrators struct {
Result []*ChatMember `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseAdministrators) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseChatMember represents the incoming response from Telegram servers.
// Used by all methods that return a ChatMember object on success.
type APIResponseChatMember struct {
Result *ChatMember `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseChatMember) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseInteger represents the incoming response from Telegram servers.
// Used by all methods that return an integer on success.
type APIResponseInteger struct {
APIResponseBase
Result int `json:"result,omitempty"`
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseInteger) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponsePoll represents the incoming response from Telegram servers.
// Used by all methods that return a Poll object on success.
type APIResponsePoll struct {
Result *Poll `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponsePoll) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseGameHighScore represents the incoming response from Telegram servers.
// Used by all methods that return an array of GameHighScore objects on success.
type APIResponseGameHighScore struct {
Result []*GameHighScore `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseGameHighScore) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseWebhook represents the incoming response from Telegram servers.
// Used by all methods that return a WebhookInfo object on success.
type APIResponseWebhook struct {
Result *WebhookInfo `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseWebhook) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseSentWebAppMessage represents the incoming response from Telegram servers.
// Used by all methods that return a SentWebAppMessage object on success.
type APIResponseSentWebAppMessage struct {
Result *SentWebAppMessage `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseSentWebAppMessage) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseMenuButton represents the incoming response from Telegram servers.
// Used by all methods that return a MenuButton object on success.
type APIResponseMenuButton struct {
Result *MenuButton `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseMenuButton) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseChatAdministratorRights represents the incoming response from Telegram servers.
// Used by all methods that return a ChatAdministratorRights object on success.
type APIResponseChatAdministratorRights struct {
Result *ChatAdministratorRights `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseChatAdministratorRights) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseForumTopic represents the incoming response from Telegram servers.
// Used by all methods that return a ForumTopic object on success.
type APIResponseForumTopic struct {
Result *ForumTopic `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseForumTopic) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseBotDescription represents the incoming response from Telegram servers.
// Used by all methods that return a BotDescription object on success.
type APIResponseBotDescription struct {
Result *BotDescription `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseBotDescription) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseBotShortDescription represents the incoming response from Telegram servers.
// Used by all methods that return a BotShortDescription object on success.
type APIResponseBotShortDescription struct {
Result *BotShortDescription `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseBotShortDescription) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseBotName represents the incoming response from Telegram servers.
// Used by all methods that return a BotName object on success.
type APIResponseBotName struct {
Result *BotName `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseBotName) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseUserChatBoosts represents the incoming response from Telegram servers.
// Used by all methods that return a UserChatBoosts object on success.
type APIResponseUserChatBoosts struct {
Result *UserChatBoosts `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseUserChatBoosts) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseBusinessConnection represents the incoming response from Telegram servers.
// Used by all methods that return a BusinessConnection object on success.
type APIResponseBusinessConnection struct {
Result *BusinessConnection `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseBusinessConnection) Base() APIResponseBase {
return a.APIResponseBase
}
// APIResponseStarTransactions represents the incoming response from Telegram servers.
// Used by all methods that return a StarTransactions object on success.
type APIResponseStarTransactions struct {
Result *StarTransactions `json:"result,omitempty"`
APIResponseBase
}
// Base returns the contained object of type APIResponseBase.
func (a APIResponseStarTransactions) Base() APIResponseBase {
return a.APIResponseBase
}
// User represents a Telegram user or bot.
type User struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name,omitempty"`
Username string `json:"username,omitempty"`
LanguageCode string `json:"language_code,omitempty"`
ID int64 `json:"id"`
IsBot bool `json:"is_bot"`
IsPremium bool `json:"is_premium,omitempty"`
AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
CanJoinGroups bool `json:"can_join_groups,omitempty"`
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
HasMainWebApp bool `json:"has_main_web_app,omitempty"`
}
// Chat represents a chat.
type Chat struct {
Type string `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
ID int64 `json:"id"`
IsForum bool `json:"is_forum,omitempty"`
}
// ChatFullInfo contains full information about a chat.
type ChatFullInfo struct {
Permissions *ChatPermissions `json:"permissions,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
ActiveUsernames *[]string `json:"active_usernames,omitempty"`
AvailableReactions *[]ReactionType `json:"available_reactions,omitempty"`
BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
PersonalChat *Chat `json:"personal_chat,omitempty"`
Birthdate *Birthdate `json:"birthdate,omitempty"`
BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`
ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`
Bio string `json:"bio,omitempty"`
Username string `json:"username,omitempty"`
Title string `json:"title,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
Description string `json:"description,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
Type string `json:"type"`
CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
AccentColorID int `json:"accent_color_id,omitempty"`
MaxReactionCount int `json:"max_reaction_count,omitempty"`
ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`
EmojiStatusExpirationDate int `json:"emoji_status_expiration_date,omitempty"`
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
UnrestrictBoostCount int `json:"unrestrict_boost_count,omitempty"`
LinkedChatID int64 `json:"linked_chat_id,omitempty"`
ID int64 `json:"id"`
IsForum bool `json:"is_forum,omitempty"`
CanSendPaidMedia bool `json:"can_send_paid_media,omitempty"`
HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"`
HasHiddenMembers bool `json:"has_hidden_members,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
HasVisibleHistory bool `json:"has_visible_history,omitempty"`
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
JoinToSendMessages bool `json:"join_to_send_messages,omitempty"`
JoinByRequest bool `json:"join_by_request,omitempty"`
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
}
// Message represents a message.
type Message struct {
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
Contact *Contact `json:"contact,omitempty"`
SenderChat *Chat `json:"sender_chat,omitempty"`
WebAppData *WebAppData `json:"web_app_data,omitempty"`
From *User `json:"from,omitempty"`
VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
Invoice *Invoice `json:"invoice,omitempty"`
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`
VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
ViaBot *User `json:"via_bot,omitempty"`
Poll *Poll `json:"poll,omitempty"`
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
Document *Document `json:"document,omitempty"`
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
LeftChatMember *User `json:"left_chat_member,omitempty"`
Animation *Animation `json:"animation,omitempty"`
Audio *Audio `json:"audio,omitempty"`
Voice *Voice `json:"voice,omitempty"`
Location *Location `json:"location,omitempty"`
Sticker *Sticker `json:"sticker,omitempty"`
Video *Video `json:"video,omitempty"`
VideoNote *VideoNote `json:"video_note,omitempty"`
Venue *Venue `json:"venue,omitempty"`
Game *Game `json:"game,omitempty"`
Dice *Dice `json:"dice,omitempty"`
ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`
ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`
ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`
GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`
GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`
GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`
Giveaway *Giveaway `json:"giveaway,omitempty"`
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`
UsersShared *UsersShared `json:"users_shared,omitempty"`
ChatShared *ChatShared `json:"chat_shared,omitempty"`
Story *Story `json:"story,omitempty"`
ReplyToStory *Story `json:"reply_to_story,omitempty"`
ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
Quote *TextQuote `json:"quote,omitempty"`
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`
BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
MediaGroupID string `json:"media_group_id,omitempty"`
ConnectedWebsite string `json:"connected_website,omitempty"`
NewChatTitle string `json:"new_chat_title,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
Caption string `json:"caption,omitempty"`
Text string `json:"text,omitempty"`
BusinessConnectionID string `json:"business_connection_id,omitempty"`
EffectID string `json:"effect_id,omitempty"`
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
NewChatPhoto []*PhotoSize `json:"new_chat_photo,omitempty"`
NewChatMembers []*User `json:"new_chat_members,omitempty"`
Photo []*PhotoSize `json:"photo,omitempty"`
Entities []*MessageEntity `json:"entities,omitempty"`
Chat Chat `json:"chat"`
ID int `json:"message_id"`
ThreadID int `json:"message_thread_id,omitempty"`
MigrateFromChatID int `json:"migrate_from_chat_id,omitempty"`
Date int `json:"date"`
MigrateToChatID int `json:"migrate_to_chat_id,omitempty"`
EditDate int `json:"edit_date,omitempty"`
SenderBoostCount int `json:"sender_boost_count,omitempty"`
DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
IsTopicMessage bool `json:"is_topic_message,omitempty"`
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
GroupChatCreated bool `json:"group_chat_created,omitempty"`
SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
IsFromOffline bool `json:"is_from_offline,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
}
// MessageID represents a unique message identifier.
type MessageID struct {
MessageID int `json:"message_id"`
}
// MessageEntity represents one special entity in a text message.
// For example, hashtags, usernames, URLs, etc.
type MessageEntity struct {
User *User `json:"user,omitempty"`
Type MessageEntityType `json:"type"`
URL string `json:"url,omitempty"`
Language string `json:"language,omitempty"`
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
Offset int `json:"offset"`
Length int `json:"length"`
}
// PhotoSize represents one size of a photo or a file / sticker thumbnail.
type PhotoSize struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Width int `json:"width"`
Height int `json:"height"`
FileSize int `json:"file_size,omitempty"`
}
// Animation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
type Animation struct {
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
Duration int `json:"duration"`
FileSize int64 `json:"file_size,omitempty"`
}
// Audio represents an audio file to be treated as music by the Telegram clients.
type Audio struct {
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Performer string `json:"performer,omitempty"`
Title string `json:"title,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
Duration int `json:"duration"`
}
// Document represents a general file (as opposed to photos, voice messages and audio files).
type Document struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
}
// Video represents a video file.
type Video struct {
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
Duration int `json:"duration"`
FileSize int64 `json:"file_size,omitempty"`
}
// VideoNote represents a video message (available in Telegram apps as of v.4.0).
type VideoNote struct {
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Length int `json:"length"`
Duration int `json:"duration"`
FileSize int `json:"file_size,omitempty"`
}
// Voice represents a voice note.
type Voice struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
MimeType string `json:"mime_type,omitempty"`
Duration int `json:"duration"`
FileSize int64 `json:"file_size,omitempty"`
}
// PaidMediaInfo describes the paid media added to a message.
type PaidMediaInfo struct {
PaidMedia []PaidMedia `json:"paid_media"`
StarCount int `json:"star_count"`
}
// PaidMedia describes paid media.
type PaidMedia struct {
Photo *[]PhotoSize `json:"photo,omitempty"`
Video *Video `json:"video,omitempty"`
Type string `json:"type"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
}
// Contact represents a phone contact.
type Contact struct {
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
LastName string `json:"last_name,omitempty"`
VCard string `json:"vcard,omitempty"`
UserID int `json:"user_id,omitempty"`
}
// Dice represents an animated emoji that displays a random value.
type Dice struct {
Emoji string `json:"emoji"`
Value int `json:"value"`
}
// PollOption contains information about one answer option in a poll.
type PollOption struct {
Text string `json:"text"`
TextEntities []*MessageEntity `json:"text_entities,omitempty"`
VoterCount int `json:"voter_count"`
}
// InputPollOption contains information about one answer option in a poll to send.
type InputPollOption struct {
Text string `json:"text"`
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
TextEntities []*MessageEntity `json:"text_entities,omitempty"`
}
// PollAnswer represents an answer of a user in a non-anonymous poll.
type PollAnswer struct {
PollID string `json:"poll_id"`
VoterChat *Chat `json:"chat,omitempty"`
User *User `json:"user,omitempty"`
OptionIDs []int `json:"option_ids"`
}
// Poll contains information about a poll.
type Poll struct {
Type string `json:"type"`
Question string `json:"question"`
Explanation string `json:"explanation,omitempty"`
ID string `json:"id"`
ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"`
QuestionEntities []*MessageEntity `json:"question_entities,omitempty"`
Options []*PollOption `json:"options"`
OpenPeriod int `json:"open_period,omitempty"`
TotalVoterCount int `json:"total_voter_count"`
CorrectOptionID int `json:"correct_option_id,omitempty"`
CloseDate int `json:"close_date,omitempty"`
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
IsClosed bool `json:"is_closed"`
IsAnonymous bool `json:"is_anonymous"`
}
// Location represents a point on the map.
type Location struct {
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
LivePeriod int `json:"live_period,omitempty"`
Heading int `json:"heading,omitempty"`
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}
// Venue represents a venue.
type Venue struct {
Location *Location `json:"location"`
Title string `json:"title"`
Address string `json:"address"`
FoursquareID string `json:"foursquare_id,omitempty"`
FoursquareType string `json:"foursquare_type,omitempty"`
GooglePlaceID string `json:"google_place_id,omitempty"`
GooglePlaceType string `json:"google_place_type,omitempty"`
}
// ProximityAlertTriggered represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
type ProximityAlertTriggered struct {
Traveler *User `json:"traveler"`
Watcher *User `json:"watcher"`
Distance int `json:"distance"`
}
// MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.
type MessageAutoDeleteTimerChanged struct {
MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}
// VideoChatScheduled represents a service message about a voice chat scheduled in the chat.
type VideoChatScheduled struct {
StartDate int `json:"start_date"`
}
// VideoChatStarted represents a service message about a voice chat started in the chat.
type VideoChatStarted struct{}
// VideoChatEnded represents a service message about a voice chat ended in the chat.
type VideoChatEnded struct {
Duration int `json:"duration"`
}
// VideoChatParticipantsInvited represents a service message about new members invited to a voice chat.
type VideoChatParticipantsInvited struct {
Users []*User `json:"users,omitempty"`
}
// UserProfilePhotos represents a user's profile pictures.
type UserProfilePhotos struct {
Photos [][]PhotoSize `json:"photos"`
TotalCount int `json:"total_count"`
}
// File represents a file ready to be downloaded.
type File struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
FilePath string `json:"file_path,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
}
// LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user.
type LoginURL struct {
URL string `json:"url"`
ForwardText string `json:"forward_text,omitempty"`
BotUsername string `json:"bot_username,omitempty"`
RequestWriteAccess bool `json:"request_write_access,omitempty"`
}
// SwitchInlineQueryChosenChat represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
type SwitchInlineQueryChosenChat struct {
Query string `json:"query,omitempty"`
AllowUserChats bool `json:"allow_user_chats,omitempty"`
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}
// CallbackQuery represents an incoming callback query from a callback button in an inline keyboard.
// If the button that originated the query was attached to a message sent by the bot,
// the field message will be present. If the button was attached to a message sent via the bot (in inline mode),
// the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
type CallbackQuery struct {
ID string `json:"id"`
From *User `json:"from"`
Message *Message `json:"message,omitempty"`
InlineMessageID string `json:"inline_message_id,omitempty"`
ChatInstance string `json:"chat_instance,omitempty"`
Data string `json:"data,omitempty"`
GameShortName string `json:"game_short_name,omitempty"`
}
// ChatPhoto represents a chat photo.
type ChatPhoto struct {
SmallFileID string `json:"small_file_id"`
SmallFileUniqueID string `json:"small_file_unique_id"`
BigFileID string `json:"big_file_id"`
BigFileUniqueID string `json:"big_file_unique_id"`
}
// ChatInviteLink represents an invite link for a chat.
type ChatInviteLink struct {
Creator *User `json:"creator"`
InviteLink string `json:"invite_link"`
Name string `json:"name,omitempty"`
PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`
ExpireDate int `json:"expire_date,omitempty"`
MemberLimit int `json:"member_limit,omitempty"`
IsPrimary bool `json:"is_primary"`
IsRevoked bool `json:"is_revoked"`
CreatesJoinRequest bool `json:"creates_join_request"`
}
// ChatMember contains information about one member of a chat.
type ChatMember struct {
User *User `json:"user"`
Status string `json:"status"`
CustomTitle string `json:"custom_title,omitempty"`
IsAnonymous bool `json:"is_anonymous,omitempty"`
CanBeEdited bool `json:"can_be_edited,omitempty"`
CanManageChat bool `json:"can_manage_chat,omitempty"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
CanPromoteMembers bool `json:"can_promote_members,omitempty"`
CanChangeInfo bool `json:"can_change_info,omitempty"`
CanInviteUsers bool `json:"can_invite_users,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
IsMember bool `json:"is_member,omitempty"`
CanSendMessages bool `json:"can_send_messages,omitempty"`
CanSendAudios bool `json:"can_send_audios,omitempty"`
CanSendDocuments bool `json:"can_send_documents,omitempty"`
CanSendPhotos bool `json:"can_send_photos,omitempty"`
CanSendVideos bool `json:"can_send_videos,omitempty"`
CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
CanSendPolls bool `json:"can_send_polls,omitempty"`
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
UntilDate int `json:"until_date,omitempty"`
}
// ChatMemberUpdated represents changes in the status of a chat member.
type ChatMemberUpdated struct {
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
Chat Chat `json:"chat"`
From User `json:"from"`
OldChatMember ChatMember `json:"old_chat_member"`
NewChatMember ChatMember `json:"new_chat_member"`
Date int `json:"date"`
ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
ViaJoinRequest bool `json:"via_join_request,omitempty"`
}
// ChatPermissions describes actions that a non-administrator user is allowed to take in a chat.
type ChatPermissions struct {