-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtypes.go
2572 lines (2318 loc) · 114 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
package telegrambot
// https://core.telegram.org/bots/api#available-types
// ChatID can be `Message.Chat.Id`,
// or target channel name (in string, eg. "@channelusername")
type ChatID any
// ChatType is a type of Chat
type ChatType string
// ChatType strings
const (
ChatTypePrivate ChatType = "private"
ChatTypeGroup ChatType = "group"
ChatTypeChannel ChatType = "channel"
)
// ParseMode is a mode of parse
type ParseMode string // parse_mode
// ParseMode strings
const (
// (legacy) https://core.telegram.org/bots/api#markdown-style
ParseModeMarkdown ParseMode = "Markdown"
// https://core.telegram.org/bots/api#markdownv2-style
ParseModeMarkdownV2 ParseMode = "MarkdownV2"
// https://core.telegram.org/bots/api#html-style
ParseModeHTML ParseMode = "HTML"
)
// ChatAction is a type of action in chats
type ChatAction string
// ChatAction strings
const (
ChatActionTyping ChatAction = "typing"
ChatActionUploadPhoto ChatAction = "upload_photo"
ChatActionRecordVideo ChatAction = "record_video"
ChatActionUploadVideo ChatAction = "upload_video"
ChatActionRecordVoice ChatAction = "record_voice"
ChatActionUploadVoice ChatAction = "upload_voice"
ChatActionUploadDocument ChatAction = "upload_document"
ChatActionChooseSticker ChatAction = "choose_sticker"
ChatActionFindLocation ChatAction = "find_location"
ChatActionRecordVideoNote ChatAction = "record_video_note"
ChatActionUploadVideoNote ChatAction = "upload_video_note"
)
// InlineQueryResultType is a type of inline query result
type InlineQueryResultType string
// InlineQueryResultType strings
const (
InlineQueryResultTypeArticle InlineQueryResultType = "article"
InlineQueryResultTypePhoto InlineQueryResultType = "photo"
InlineQueryResultTypeGif InlineQueryResultType = "gif"
InlineQueryResultTypeMpeg4Gif InlineQueryResultType = "mpeg4_gif"
InlineQueryResultTypeVideo InlineQueryResultType = "video"
InlineQueryResultTypeAudio InlineQueryResultType = "audio"
InlineQueryResultTypeVoice InlineQueryResultType = "voice"
InlineQueryResultTypeDocument InlineQueryResultType = "document"
InlineQueryResultTypeLocation InlineQueryResultType = "location"
InlineQueryResultTypeVenue InlineQueryResultType = "venue"
InlineQueryResultTypeContact InlineQueryResultType = "contact"
InlineQueryResultTypeSticker InlineQueryResultType = "sticker"
InlineQueryResultTypeGame InlineQueryResultType = "game"
)
// ThumbnailMimeType is a type of inline query result's thumbnail mime type
type ThumbnailMimeType string
// ThumbnailMimeType strings
const (
ThumbnailMimeTypeImageJpeg ThumbnailMimeType = "image/jpeg"
ThumbnailMimeTypeImageGif ThumbnailMimeType = "image/gif"
ThumbnailMimeTypeVideoMp4 ThumbnailMimeType = "video/mp4"
)
// MessageEntityType is a type of MessageEntity
//
// https://core.telegram.org/bots/api#messageentity
type MessageEntityType string
// MessageEntityType strings
const (
MessageEntityTypeMention MessageEntityType = "mention"
MessageEntityTypeHashTag MessageEntityType = "hashtag"
MessageEntityTypeCashTag MessageEntityType = "cashtag"
MessageEntityTypeBotCommand MessageEntityType = "bot_command"
MessageEntityTypeURL MessageEntityType = "url"
MessageEntityTypeEmail MessageEntityType = "email"
MessageEntityTypePhoneNumber MessageEntityType = "phone_number"
MessageEntityTypeBold MessageEntityType = "bold"
MessageEntityTypeItalic MessageEntityType = "italic"
MessageEntityTypeUnderline MessageEntityType = "underline"
MessageEntityTypeStrikethrough MessageEntityType = "strikethrough"
MessageEntityTypeSpoiler MessageEntityType = "spoiler"
MessageEntityTypeBlockquote MessageEntityType = "blockquote"
MessageEntityTypeCode MessageEntityType = "code"
MessageEntityTypePre MessageEntityType = "pre"
MessageEntityTypeTextLink MessageEntityType = "text_link"
MessageEntityTypeTextMention MessageEntityType = "text_mention"
MessageEntityTypeCustomEmoji MessageEntityType = "custom_emoji"
)
// ChatMemberStatus is a status of chat member
//
// https://core.telegram.org/bots/api#chatmember
type ChatMemberStatus string
// ChatMemberStatus strings
const (
ChatMemberStatusCreator ChatMemberStatus = "creator"
ChatMemberStatusAdministrator ChatMemberStatus = "administrator"
ChatMemberStatusMember ChatMemberStatus = "member"
ChatMemberStatusRestricted ChatMemberStatus = "restricted"
ChatMemberStatusLeft ChatMemberStatus = "left"
ChatMemberStatusBanned ChatMemberStatus = "kicked"
)
// MaskPositionPoint is a point in MaskPosition
//
// https://core.telegram.org/bots/api#maskposition
type MaskPositionPoint string
// MaskPosition points
const (
MaskPositionForehead MaskPositionPoint = "forehead"
MaskPositionEyes MaskPositionPoint = "eyes"
MaskPositionMouth MaskPositionPoint = "mouth"
MaskPositionChin MaskPositionPoint = "chin"
)
// APIResponse is a base of API responses
type APIResponse[T any] struct {
Ok bool `json:"ok"`
Description *string `json:"description,omitempty"`
Parameters *APIResponseParameters `json:"parameters,omitempty"`
Result *T `json:"result,omitempty"`
}
// APIResponseMessageOrBool type for ambiguous type of `result`
type APIResponseMessageOrBool struct {
Ok bool `json:"ok"`
Description *string `json:"description,omitempty"`
Parameters *APIResponseParameters `json:"parameters,omitempty"`
ResultMessage *Message `json:"result_message,omitempty"`
ResultBool *bool `json:"result_bool,omitempty"`
}
// APIResponseParameters is parameters in API responses
//
// https://core.telegram.org/bots/api#responseparameters
type APIResponseParameters struct {
MigrateToChatID *int64 `json:"migrate_to_chat_id,omitempty"`
RetryAfter *int `json:"retry_after,omitempty"`
}
// UpdateType is a type of updates (for allowed_updates)
//
// https://core.telegram.org/bots/api#setwebhook
// https://core.telegram.org/bots/api#update
type UpdateType string
// UpdateType strings
const (
UpdateTypeMessage UpdateType = "message"
UpdateTypeEditedMessage UpdateType = "edited_message"
UpdateTypeChannelPost UpdateType = "channel_post"
UpdateTypeEditedChannelPost UpdateType = "edited_channel_post"
UpdateTypeInlineQuery UpdateType = "inline_query"
UpdateTypeChosenInlineResult UpdateType = "chosen_inline_result"
UpdateTypeCallbackQuery UpdateType = "callback_query"
UpdateTypeShippingQuery UpdateType = "shipping_query"
UpdateTypePreCheckoutQuery UpdateType = "pre_checkout_query"
UpdateTypePoll UpdateType = "poll"
)
// WebhookInfo is a struct of webhook info
//
// https://core.telegram.org/bots/api#webhookinfo
type WebhookInfo struct {
URL *string `json:"url"`
HasCustomCertificate bool `json:"has_custom_certificate"`
PendingUpdateCount int `json:"pending_update_count"`
IPAddress *string `json:"ip_address,omitempty"`
LastErrorDate *int `json:"last_error_date,omitempty"`
LastErrorMessage *string `json:"last_error_message,omitempty"`
LastSynchronizationErrorDate *int `json:"last_synchronization_error_date,omitempty"`
MaxConnections *int `json:"max_connections,omitempty"`
AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"`
}
// Update is a struct of an update
//
// https://core.telegram.org/bots/api#update
type Update struct {
UpdateID int64 `json:"update_id"`
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"`
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,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"`
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
}
// AllowedUpdate is a type for 'allowed_updates'
type AllowedUpdate string
// AllowedUpdate type constants
//
// https://core.telegram.org/bots/api#update
const (
AllowMessage AllowedUpdate = "message"
AllowEditedMessage AllowedUpdate = "edited_message"
AllowChannelPost AllowedUpdate = "channel_post"
AllowEditedChannelPost AllowedUpdate = "edited_channel_post"
AllowBusinessConnection AllowedUpdate = "business_connection"
AllowBusinessMessage AllowedUpdate = "business_message"
AllowEditedBusinessMessage AllowedUpdate = "edited_business_message"
AllowDeletedBusinessMessages AllowedUpdate = "deleted_business_messages"
AllowMessageReaction AllowedUpdate = "message_reaction" // NOTE: must be an admin, and need to be explicitly specified
AllowMessageReactionCount AllowedUpdate = "message_reaction_count" // NOTE: must be an admin, and need to be explicitly specified
AllowInlineQuery AllowedUpdate = "inline_query"
AllowChosenInlineResult AllowedUpdate = "chosen_inline_result"
AllowCallbackQuery AllowedUpdate = "callback_query"
AllowShippingQuery AllowedUpdate = "shipping_query"
AllowPreCheckoutQuery AllowedUpdate = "pre_checkout_query"
AllowPurchasedPaidMedia AllowedUpdate = "purchased_paid_media"
AllowPoll AllowedUpdate = "poll"
AllowPollAnswer AllowedUpdate = "poll_answer"
AllowMyChatMember AllowedUpdate = "my_chat_member"
AllowChatMember AllowedUpdate = "chat_member" // NOTE: must be an admin, and need to be explicitly specified
AllowChatJoinRequest AllowedUpdate = "chat_join_request" // NOTE: must have `can_invite_users` admin right
AllowChatBoost AllowedUpdate = "chat_boost" // NOTE: must be an admin
AllowRemovedChatBoost AllowedUpdate = "removed_chat_boost" // NOTE: must be an admin
)
// User is a struct of a user
//
// https://core.telegram.org/bots/api#user
type User struct {
ID int64 `json:"id"`
IsBot bool `json:"is_bot"`
FirstName string `json:"first_name"`
LastName *string `json:"last_name,omitempty"`
Username *string `json:"username,omitempty"`
LanguageCode *string `json:"language_code,omitempty"` // https://en.wikipedia.org/wiki/IETF_language_tag
IsPremium *bool `json:"is_premium,omitempty"`
AddedToAttachmentMenu *bool `json:"added_to_attachment_menu,omitempty"`
CanJoinGroups *bool `json:"can_join_groups,omitempty"` // returned only in GetMe()
CanReadAllGroupMessages *bool `json:"can_read_all_group_messages,omitempty"` // returned only in GetMe()
SupportsInlineQueries *bool `json:"supports_inline_queries,omitempty"` // returned only in GetMe()
CanConnectToBusiness *bool `json:"can_connect_to_business,omitempty"` // returned only in GetMe()
HasMainWebApp *bool `json:"has_main_web_app,omitempty"` // returned only in GetMe()
}
// Chat is a struct of a chat
//
// https://core.telegram.org/bots/api#chat
type Chat struct {
ID int64 `json:"id"`
Type ChatType `json:"type"`
Title *string `json:"title,omitempty"`
Username *string `json:"username,omitempty"`
FirstName *string `json:"first_name,omitempty"`
LastName *string `json:"last_name,omitempty"`
IsForum *bool `json:"is_forum,omitempty"`
}
// ChatFullInfo is a struct for a full info of chat
//
// https://core.telegram.org/bots/api#chatfullinfo
type ChatFullInfo struct {
ID int64 `json:"id"`
Type ChatType `json:"type"`
Title *string `json:"title,omitempty"`
Username *string `json:"username,omitempty"`
FirstName *string `json:"first_name,omitempty"`
LastName *string `json:"last_name,omitempty"`
IsForum *bool `json:"is_forum,omitempty"`
AccentColorID int `json:"accent_color_id"`
MaxReactionCount int `json:"max_reaction_count"`
Photo *ChatPhoto `json:"photo,omitempty"`
ActiveUsernames []string `json:"active_usernames,omitempty"`
Birthdate *Birthdate `json:"birthdate,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"`
AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
BackgroundCustomEmojiID *string `json:"background_custom_emoji_id,omitempty"`
ProfileAccentColorID *int `json:"profile_accent_color_id,omitempty"`
ProfileBackgroundCustomEmojiID *string `json:"profile_background_custom_emoji_id,omitempty"`
EmojiStatusCustomEmojiID *string `json:"emoji_status_custom_emoji_id,omitempty"`
EmojiStatusExpirationDate *int `json:"emoji_status_expiration_date,omitempty"`
Bio *string `json:"bio,omitempty"`
HasPrivateForwards *bool `json:"has_private_forwards,omitempty"`
HasRestrictedVoiceAndVideoMessages *bool `json:"has_restricted_voice_and_video_messages,omitempty"`
JoinToSendMessages *bool `json:"join_to_send_messages,omitempty"`
JoinByRequest *bool `json:"join_by_request,omitempty"`
Description *string `json:"description,omitempty"`
InviteLink *string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
CanSendPaidMedia *bool `json:"can_send_paid_media,omitempty"`
SlowModeDelay *int `json:"slow_mode_delay,omitempty"`
UnrestrictBoostCount *int `json:"unrestrict_boost_count,omitempty"`
MessageAutoDeleteTime *int `json:"message_auto_delete_time,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"`
StickerSetName *string `json:"sticker_set_name,omitempty"`
CanSetStickerSet *bool `json:"can_set_sticker_set,omitempty"`
CustomEmojiStickerSetName *string `json:"custom_emoji_sticker_set_name,omitempty"`
LinkedChatID *int64 `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
}
// InputMediaType is a type of InputMedia
type InputMediaType string
// InputMediaType strings
const (
InputMediaAnimation InputMediaType = "animation" // https://core.telegram.org/bots/api#inputmediaanimation
InputMediaDocument InputMediaType = "document" // https://core.telegram.org/bots/api#inputmediadocument
InputMediaAudio InputMediaType = "audio" // https://core.telegram.org/bots/api#inputmediaaudio
InputMediaPhoto InputMediaType = "photo" // https://core.telegram.org/bots/api#inputmediaphoto
InputMediaVideo InputMediaType = "video" // https://core.telegram.org/bots/api#inputmediavideo
)
// InputMedia represents the content of a media message to be sent.
//
// NOTE: Can be generated with NewInputMedia() function in types_helper.go
//
// https://core.telegram.org/bots/api#inputmedia
type InputMedia struct {
Type InputMediaType `json:"type"`
Media string `json:"media"`
Thumbnail *InputFile `json:"thumbnail,omitempty"` // video, animation, audio, document
Caption *string `json:"caption,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
HasSpoiler *bool `json:"has_spoiler,omitempty"` // video, animation, photo
ParseMode *ParseMode `json:"parse_mode,omitempty"`
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"` // animation, photo, video
Width *int `json:"width,omitempty"` // video, animation
Height *int `json:"height,omitempty"` // video, animation
Duration *int `json:"duration,omitempty"` // video, animation
Performer *string `json:"performer,omitempty"` // audio only
Title *string `json:"title,omitempty"` // audio only
SupportsStreaming *bool `json:"supports_streaming,omitempty"` // video only
DisableContentTypeDetection *bool `json:"disable_content_type_detection,omitempty"` // document only
}
// InputFile represents contents of a file to be uploaded.
//
// NOTE: Can be generated with NewInputFileFromXXX() functions in types_helper.go
//
// https://core.telegram.org/bots/api#inputfile
type InputFile struct {
Filepath *string
URL *string
Bytes []byte
FileID *string
}
// InputPaidMedia can be one of `InputPaidMediaPhoto` or `InputPaidMediaVideo`
//
// https://core.telegram.org/bots/api#inputpaidmedia
type InputPaidMedia any
// InputPaidMediaPhoto struct
//
// https://core.telegram.org/bots/api#inputpaidmediaphoto
type InputPaidMediaPhoto struct {
Type string `json:"type"` // == "photo"
Media string `json:"media"`
}
// InputPaidMediaVideo struct
//
// https://core.telegram.org/bots/api#inputpaidmediavideo
type InputPaidMediaVideo struct {
Type string `json:"type"` // == "video"
Media string `json:"media"`
Thumbnail any `json:"thumbnail,omitempty"` // `InputFile` or string
Width *int `json:"width,omitempty"`
Height *int `json:"height,omitempty"`
Duration *int `json:"duration,omitempty"`
SupportsStreaming *bool `json:"supports_streaming,omitempty"`
}
// StickerFormat is a format of sticker
type StickerFormat string
// StickerFormat strings
const (
StickerFormatStatic StickerFormat = "static"
StickerFormatAnimated StickerFormat = "animated"
StickerFormatVideo StickerFormat = "video"
)
// StickerType is a type of sticker
type StickerType string
// StickerType strings
const (
StickerTypeRegular StickerType = "regular"
StickerTypeMask StickerType = "mask"
StickerTypeCustomEmoji StickerType = "custom_emoji"
)
// Audio is a struct for an audio file
//
// https://core.telegram.org/bots/api#audio
type Audio struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Duration int `json:"duration"`
Performer *string `json:"performer,omitempty"`
Title *string `json:"title,omitempty"`
FileName *string `json:"file_name,omitempty"`
MimeType *string `json:"mime_type,omitempty"`
FileSize *int `json:"file_size,omitempty"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}
// MessageEntity is a struct of a message entity
//
// NOTE: Can be generated with NewMessageEntity() function in types_helper.go
//
// https://core.telegram.org/bots/api#messageentity
type MessageEntity struct {
Type MessageEntityType `json:"type"`
Offset int `json:"offset"`
Length int `json:"length"`
URL *string `json:"url,omitempty"` // when Type == MessageEntityTypeTextLink
User *User `json:"user,omitempty"` // when Type == MessageEntityTypeTextMention
Language *string `json:"language,omitempty"` // when Type == MessageEntityTypePre
CustomEmojiID *string `json:"custom_emoji_id,omitempty"` // when Type == MessageEntityTypeCustomEmoji
}
// TextQuote is a struct of a text quote
//
// https://core.telegram.org/bots/api#textquote
type TextQuote struct {
Text string `json:"text"`
Entities []MessageEntity `json:"entities,omitempty"`
Position int `json:"position"`
IsManual *bool `json:"is_manual,omitempty"`
}
// ExternalReplyInfo is a struct of an external reply info of a message
//
// https://core.telegram.org/bots/api#externalreplyinfo
type ExternalReplyInfo struct {
Origin MessageOrigin `json:"origin"`
Chat *Chat `json:"chat,omitempty"`
MessageID *int64 `json:"message_id,omitempty"`
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
Animation *Animation `json:"animation,omitempty"`
Audio *Audio `json:"audio,omitempty"`
Document *Document `json:"document,omitempty"`
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
Sticker *Sticker `json:"sticker,omitempty"`
Story *Story `json:"story,omitempty"`
Video *Video `json:"video,omitempty"`
VideoNote *VideoNote `json:"video_note,omitempty"`
Voice *Voice `json:"voice,omitempty"`
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
Contact *Contact `json:"contact,omitempty"`
Dice *Dice `json:"dice,omitempty"`
Game *Game `json:"game,omitempty"`
Giveaway *Giveaway `json:"giveaway,omitempty"`
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
Invoice *Invoice `json:"invoice,omitempty"`
Location *Location `json:"location,omitempty"`
Poll *Poll `json:"poll,omitempty"`
Venue *Venue `json:"venue,omitempty"`
}
// ReplyParameters is a struct for replying messages
//
// NOTE: Can be generated with NewReplyParameters() function in types_helper.go
//
// https://core.telegram.org/bots/api#replyparameters
type ReplyParameters struct {
MessageID int64 `json:"message_id"`
ChatID *ChatID `json:"chat_id,omitempty"`
AllowSendingWithoutReply *bool `json:"allow_sending_without_reply,omitempty"`
Quote *string `json:"quote,omitempty"`
QuoteParseMode *ParseMode `json:"quote_parse_mode,omitempty"`
QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`
QuotePosition *int `json:"quote_position,omitempty"`
}
// MessageOrigin struct for describing the origin of a message
//
// https://core.telegram.org/bots/api#messageorigin
type MessageOrigin struct {
Type string `json:"type"`
Date int `json:"date"`
// https://core.telegram.org/bots/api#messageoriginuser
SenderUser *User `json:"sender_user,omitempty"`
// https://core.telegram.org/bots/api#messageoriginhiddenuser
SenderUserName *string `json:"sender_user_name,omitempty"`
// https://core.telegram.org/bots/api#messageoriginchat
SenderChat *Chat `json:"sender_chat,omitempty"`
AuthorSignature *string `json:"author_signature,omitempty"`
// https://core.telegram.org/bots/api#messageoriginchannel
Chat *Chat `json:"chat,omitempty"`
MessageID *int64 `json:"message_id,omitempty"`
// AuthorSignature *string `json:"author_signature,omitempty"`
}
// PhotoSize is a struct of a photo's size
//
// https://core.telegram.org/bots/api#photosize
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"`
}
// Document is a struct for an ordinary file
//
// https://core.telegram.org/bots/api#document
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 int `json:"file_size,omitempty"`
}
// Sticker is a struct of a sticker
//
// https://core.telegram.org/bots/api#sticker
type Sticker struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Type StickerType `json:"type"`
Width int `json:"width"`
Height int `json:"height"`
IsAnimated bool `json:"is_animated"`
IsVideo bool `json:"is_video"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
Emoji *string `json:"emoji,omitempty"`
SetName *string `json:"set_name,omitempty"`
PremiumAnimation *File `json:"premium_animation,omitempty"`
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
CustomEmojiID *string `json:"custom_emoji_id,omitempty"`
NeedsRepainting *bool `json:"needs_repainting,omitempty"`
FileSize *int `json:"file_size,omitempty"`
}
// StickerSet is a struct of a sticker set
//
// https://core.telegram.org/bots/api#stickerset
type StickerSet struct {
Name string `json:"name"`
Title string `json:"title"`
StickerType StickerType `json:"sticker_type"`
Stickers []Sticker `json:"stickers"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}
// MaskPosition is a struct for a mask position
//
// NOTE: Can be generated with NewMaskPosition() function in types_helper.go
//
// https://core.telegram.org/bots/api#maskposition
type MaskPosition struct {
Point MaskPositionPoint `json:"point"`
XShift float32 `json:"x_shift"`
YShift float32 `json:"y_shift"`
Scale float32 `json:"scale"`
}
// InputSticker is a struct for a sticker
//
// NOTE: Can be generated with NewInputSticker() function in types_helper.go
//
// https://core.telegram.org/bots/api#inputsticker
type InputSticker struct {
Sticker any `json:"sticker"` // InputFile or `file_id`
Format StickerFormat `json:"format"` // "static" for .webp or .png, "animated" for .tgs, "video" for .webm
EmojiList []string `json:"emoji_list"`
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
Keywords []string `json:"keywords,omitempty"`
}
// Story is a struct for a forwarded story of a message
//
// https://core.telegram.org/bots/api#story
type Story struct {
Chat Chat `json:"chat"`
ID int64 `json:"id"`
}
// Video is a struct for a video file
//
// https://core.telegram.org/bots/api#video
type Video struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Width int `json:"width"`
Height int `json:"height"`
Duration int `json:"duration"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileName *string `json:"file_name,omitempty"`
MimeType *string `json:"mime_type,omitempty"`
FileSize *int `json:"file_size,omitempty"`
}
// PaidMediaInfo struct
//
// https://core.telegram.org/bots/api#paidmediainfo
type PaidMediaInfo struct {
StarCount int `json:"star_count"`
PaidMedia []PaidMedia `json:"paid_media"`
}
// PaidMedia can be one of `PaidMediaPreview`, `PaidMediaPhoto`, or `PaidMediaVideo`
//
// https://core.telegram.org/bots/api#paidmedia
type PaidMedia any
// PaidMediaPreview struct
//
// https://core.telegram.org/bots/api#paidmediapreview
type PaidMediaPreview struct {
Type string `json:"type"` // == "preview"
Width int `json:"width"`
Height int `json:"height"`
Duration int `json:"duration"`
}
// PaidMediaPhoto struct
//
// https://core.telegram.org/bots/api#paidmediaphoto
type PaidMediaPhoto struct {
Type string `json:"type"` // == "photo"
Photo []PhotoSize `json:"photo"`
}
// PaidMediaVideo struct
//
// https://core.telegram.org/bots/api#paidmediavideo
type PaidMediaVideo struct {
Type string `json:"type"` // == "video"
Video Video `json:"video"`
}
// Voice is a struct for a voice file
//
// https://core.telegram.org/bots/api#voice
type Voice struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Duration int `json:"duration"`
MimeType *string `json:"mime_type,omitempty"`
FileSize *int `json:"file_size,omitempty"`
}
// VideoNote is a struct for a video note
//
// https://core.telegram.org/bots/api#videonote
type VideoNote struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Length int `json:"length"`
Duration int `json:"duration"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileSize *int `json:"file_size,omitempty"`
}
// Contact is a struct for a contact info
//
// https://core.telegram.org/bots/api#contact
type Contact struct {
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
LastName *string `json:"last_name,omitempty"`
UserID *int64 `json:"user_id,omitempty"`
VCard *string `json:"vcard,omitempty"` // https://en.wikipedia.org/wiki/VCard
}
// Location is a struct for a location
//
// https://core.telegram.org/bots/api#location
type Location struct {
Longitude float32 `json:"longitude"`
Latitude float32 `json:"latitude"`
HorizontalAccuracy float32 `json:"horizontal_accuracy,omitempty"`
LivePeriod *int `json:"live_period,omitempty"`
Heading *int `json:"heading,omitempty"`
ProximityAlertRadius *int `json:"proximity_alert_radius,omitempty"`
}
// Venue is a struct of a venue
//
// https://core.telegram.org/bots/api#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"`
}
// WebAppData is a struct of a web app data
//
// https://core.telegram.org/bots/api#webappdata
type WebAppData struct {
Data string `json:"data"`
ButtonText string `json:"button_text"`
}
// ProximityAlertTriggered is a struct of priximity alert triggered object
//
// https://core.telegram.org/bots/api#proximityalerttriggered
type ProximityAlertTriggered struct {
Traveler User `json:"traveler"`
Watcher User `json:"watcher"`
Distance int `json:"distance"`
}
// ChatBoostAdded is a struct of an added boost to a chat
//
// https://core.telegram.org/bots/api#chatboostadded
type ChatBoostAdded struct {
BoostCount int `json:"boost_count"`
}
// Poll is a struct of a poll
//
// https://core.telegram.org/bots/api#poll
type Poll struct {
ID string `json:"id"`
Question string `json:"question"` // 1~255 chars
QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
Options []PollOption `json:"options"`
TotalVoterCount int `json:"total_voter_count"`
IsClosed bool `json:"is_closed"`
IsAnonymous bool `json:"is_anonymous"`
Type string `json:"type"` // "quiz" or "regular"
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
CorrectOptionID *int `json:"correct_option_id,omitempty"`
Explanation *string `json:"explanation,omitempty"`
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
OpenPeriod *int `json:"open_period,omitempty"`
CloseDate *int `json:"close_date,omitempty"`
}
// PollOption is a struct of a poll option
//
// https://core.telegram.org/bots/api#polloption
type PollOption struct {
Text string `json:"text"` // 1~100 chars
TextEntities []MessageEntity `json:"text_entities,omitempty"`
VoterCount int `json:"voter_count"`
}
// InputPollOption is a struct of an input poll option
//
// https://core.telegram.org/bots/api#inputpolloption
type InputPollOption struct {
Text string `json:"text"` // 1~100 chars
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
TextEntities []MessageEntity `json:"text_entities,omitempty"`
}
// PollAnswer is a struct of a poll answer
//
// https://core.telegram.org/bots/api#pollanswer
type PollAnswer struct {
PollID string `json:"poll_id"`
VoterChat *Chat `json:"voter_chat,omitempty"`
User *User `json:"user,omitempty"`
OptionIDs []int `json:"option_ids"`
}
// Dice is a struct for dice in message
//
// https://core.telegram.org/bots/api#dice
type Dice struct {
Emoji string `json:"emoji"`
Value int `json:"value"` // 1-6 for dice, dart, and bowling; 1-5 for basketball and football; 1-64 for slotmachine;
}
// MessageAutoDeleteTimerChanged is service message: message auto delete timer changed
//
// https://core.telegram.org/bots/api#messageautodeletetimerchanged
type MessageAutoDeleteTimerChanged struct {
MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}
// ChatBackground is a struct for chat background
//
// https://core.telegram.org/bots/api#chatbackground
type ChatBackground struct {
Type BackgroundType `json:"type"`
}
// BackgroundTypeType for types of BackgroundType
type BackgroundTypeType string
// BackgroundTypeType constants
const (
BackgroundTypeFill BackgroundTypeType = "fill" // https://core.telegram.org/bots/api#backgroundtypefill
BackgroundTypeWallpaper BackgroundTypeType = "wallpaper" // https://core.telegram.org/bots/api#backgroundtypewallpaper
BackgroundTypePattern BackgroundTypeType = "pattern" // https://core.telegram.org/bots/api#backgroundtypepattern
BackgroundTypeChatTheme BackgroundTypeType = "chat_theme" // https://core.telegram.org/bots/api#backgroundtypechattheme
)
// BackgroundType is a struct for a type of background
//
// https://core.telegram.org/bots/api#backgroundtype
type BackgroundType struct {
Type BackgroundTypeType `json:"type"`
// type == "fill"
Fill *BackgroundFill `json:"fill,omitempty"`
DarkThemeDimming *int `json:"dark_theme_dimming,omitempty"`
// type == "wallpaper"
Document *Document `json:"document,omitempty"`
// DarkThemeDimming *int `json:"dark_theme_dimming,omitempty"`
IsBlurred *bool `json:"is_blurred,omitempty"`
IsMoving *bool `json:"is_moving,omitempty"`
// type == "pattern"
// Document *Document `json:"document,omitempty"`
// Fill *BackgroundFill `json:"fill,omitempty"`
Intensity *int `json:"intensity,omitempty"`
IsInverted *bool `json:"is_inverted,omitempty"`
// IsMoving *bool `json:"is_moving,omitempty"`
// type == "chat_theme"
ThemeName *string `json:"theme_name,omitempty"`
}
// BackgroundFillType for types of BackgroundFill
type BackgroundFillType string
// BackgroundFillType constants
const (
BackgroundFillTypeSolid BackgroundFillType = "solid"
BackgroundFillTypeGradient BackgroundFillType = "gradient"
BackgroundFillTypeFreeformGradient BackgroundFillType = "freeform_gradient"
)
// BackgroundFill is a struct for a type of background fill
//
// https://core.telegram.org/bots/api#backgroundfill
type BackgroundFill struct {
Type BackgroundFillType `json:"type"`
// type == "solid"
Color *int `json:"color,omitempty"`
// type == "gradient"
TopColor *int `json:"top_color,omitempty"` // RGB24
BottomColor *int `json:"bottom_color,omitempty"` // RGB24
RotationAngle *int `json:"rotation_angle,omitempty"` // 0-359
// type == "freeform_gradient"
Colors []int `json:"colors,omitempty"`
}
// ForumTopicCreated is a struct for a new forum topic created in the chat.
//
// https://core.telegram.org/bots/api#forumtopiccreated
type ForumTopicCreated struct {
Name string `json:"name"`
IconColor int `json:"icon_color"`
IconCustomEmojiID *string `json:"icon_custom_emoji_id,omitempty"`
}
// ForumTopicClosed is a struct for a closed forum topic in the chat.
//
// https://core.telegram.org/bots/api#forumtopicclosed
type ForumTopicClosed struct{}
// ForumTopicEdited is a struct for a edited forum topic in the chat.
//
// https://core.telegram.org/bots/api#forumtopicedited
type ForumTopicEdited struct {
Name *string `json:"name,omitempty"`
IconCustomEmojiID *string `json:"icon_custom_emoji_id,omitempty"`
}
// ForumTopicReopened is a struct for a reopened forum topic in the chat.
//
// https://core.telegram.org/bots/api#forumtopicreopened
type ForumTopicReopened struct{}
// GeneralForumTopicHidden is a struct for a hidden general forum topic in the chat.
//
// https://core.telegram.org/bots/api#generalforumtopichidden
type GeneralForumTopicHidden struct{}
// GeneralForumTopicUnhidden is a struct for an unhidden general forum topic in the chat.
//
// https://core.telegram.org/bots/api#generalforumtopicunhidden
type GeneralForumTopicUnhidden struct{}
// SharedUser is a struct for a user which was shared with the bot using KeyboardButtonRequestUser button.
//
// https://core.telegram.org/bots/api#shareduser
type SharedUser struct {
UserID int64 `json:"user_id"`
FirstName *string `json:"first_name,omitempty"`
LastName *string `json:"last_name,omitempty"`
Username *string `json:"username,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
}
// UsersShared is a struct for users who shared the message.
//
// https://core.telegram.org/bots/api#usersshared
type UsersShared struct {
RequestID int64 `json:"request_id"`
Users []SharedUser `json:"users"`
}
// ChatShared is a struct for a chat which shared the message.
//
// https://core.telegram.org/bots/api#chatshared
type ChatShared struct {
RequestID int64 `json:"request_id"`
ChatID int64 `json:"chat_id"`
Title *string `json:"title,omitempty"`
Username *string `json:"username,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
}
// WriteAccessAllowed is a struct for an allowed write access in the chat.
//
// https://core.telegram.org/bots/api#writeaccessallowed
type WriteAccessAllowed struct {
FromRequest *bool `json:"from_request,omitempty"`
WebAppName *string `json:"web_app_name,omitempty"`
FromAttachmentMenu *bool `json:"from_attachment_menu,omitempty"`
}
// VideoChatStarted is a struct for service message: video chat started.
//
// https://core.telegram.org/bots/api#videochatstarted
type VideoChatStarted struct{}
// VideoChatEnded is a struct for service message: video chat ended
//
// https://core.telegram.org/bots/api#videochatended
type VideoChatEnded struct {
Duration int `json:"duration"`
}
// VideoChatScheduled is a struct for servoice message: video chat scheduled
//
// https://core.telegram.org/bots/api#videochatscheduled
type VideoChatScheduled struct {
StartDate int `json:"start_date"`
}
// VideoChatParticipantsInvited is a struct for service message: new members invited to video chat
//
// https://core.telegram.org/bots/api#videochatparticipantsinvited