-
Notifications
You must be signed in to change notification settings - Fork 25
/
options.go
789 lines (704 loc) · 37.6 KB
/
options.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
/*
* 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
// ParseMode is a custom type for the various frequent options used by some methods of the API.
type ParseMode string
// These are all the possible options that can be used by some methods.
const (
Markdown ParseMode = "Markdown"
MarkdownV2 = "MarkdownV2"
HTML = "HTML"
)
// PollType is a custom type for the various types of poll that can be sent.
type PollType string
// These are all the possible poll types.
const (
Quiz PollType = "quiz"
Regular = "regular"
Any = ""
)
// DiceEmoji is a custom type for the various emojis that can be sent through the SendDice method.
type DiceEmoji string
// These are all the possible emojis that can be sent through the SendDice method.
const (
Die DiceEmoji = "🎲"
Darts = "🎯"
Basket = "🏀"
Goal = "⚽️"
Bowling = "🎳"
Slot = "🎰"
)
// ChatAction is a custom type for the various actions that can be sent through the SendChatAction method.
type ChatAction string
// These are all the possible actions that can be sent through the SendChatAction method.
const (
Typing ChatAction = "typing"
UploadPhoto = "upload_photo"
RecordVideo = "record_video"
UploadVideo = "upload_video"
RecordAudio = "record_audio"
UploadAudio = "upload_audio"
UploadDocument = "upload_document"
FindLocation = "find_location"
RecordVideoNote = "record_video_note"
UploadVideoNote = "upload_video_note"
ChooseSticker = "choose_sticker"
)
// MessageEntityType is a custom type for the various MessageEntity types used in various methods.
type MessageEntityType string
// These are all the possible types for MessageEntityType.
const (
MentionEntity MessageEntityType = "mention"
HashtagEntity = "hashtag"
CashtagEntity = "cashtag"
BotCommandEntity = "bot_command"
UrlEntity = "url"
EmailEntity = "email"
PhoneNumberEntity = "phone_number"
BoldEntity = "bold"
ItalicEntity = "italic"
UnderlineEntity = "underline"
StrikethroughEntity = "strikethrough"
SpoilerEntity = "spoiler"
BlockQuoteEntity = "blockquote"
ExpandableBlockQuoteEntity = "expandable_blockquote"
CodeEntity = "code"
PreEntity = "pre"
TextLinkEntity = "text_link"
TextMentionEntity = "text_mention"
CustomEmojiEntity = "custom_emoji"
)
// UpdateType is a custom type for the various update types that a bot can be subscribed to.
type UpdateType string
// These are all the possible types that a bot can be subscribed to.
const (
MessageUpdate UpdateType = "message"
EditedMessageUpdate = "edited_message"
ChannelPostUpdate = "channel_post"
EditedChannelPostUpdate = "edited_channel_post"
InlineQueryUpdate = "inline_query"
ChosenInlineResultUpdate = "chosen_inline_result"
CallbackQueryUpdate = "callback_query"
ShippingQueryUpdate = "shipping_query"
PreCheckoutQueryUpdate = "pre_checkout_query"
PollUpdate = "poll"
PollAnswerUpdate = "poll_answer"
MyChatMemberUpdate = "my_chat_member"
ChatMemberUpdate = "chat_member"
)
// ReplyMarkup is an interface for the various keyboard types.
type ReplyMarkup interface {
ImplementsReplyMarkup()
}
// KeyboardButton represents a button in a keyboard.
type KeyboardButton struct {
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
Text string `json:"text"`
RequestContact bool `json:"request_contact,omitempty"`
RequestLocation bool `json:"request_location,omitempty"`
}
// KeyboardButtonPollType represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
type KeyboardButtonPollType struct {
Type PollType `json:"type"`
}
// KeyboardButtonRequestUsers defines the criteria used to request suitable users.
// The identifiers of the selected users will be shared with the bot when the corresponding button is pressed.
type KeyboardButtonRequestUsers struct {
RequestID int `json:"request_id"`
MaxQuantity int `json:"max_quantity,omitempty"`
UserIsBot bool `json:"user_is_bot,omitempty"`
UserIsPremium bool `json:"user_is_premium,omitempty"`
RequestName bool `json:"request_name,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
}
// KeyboardButtonRequestChat defines the criteria used to request a suitable chat.
// The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.
type KeyboardButtonRequestChat struct {
UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
RequestID int `json:"request_id"`
ChatIsChannel bool `json:"chat_is_channel,omitempty"`
ChatIsForum bool `json:"chat_is_forum,omitempty"`
ChatHasUsername bool `json:"chat_has_username,omitempty"`
ChatIsCreated bool `json:"chat_is_created,omitempty"`
BotIsMember bool `json:"bot_is_member,omitempty"`
RequestName bool `json:"request_name,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
}
// ReplyKeyboardMarkup represents a custom keyboard with reply options.
type ReplyKeyboardMarkup struct {
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
Keyboard [][]KeyboardButton `json:"keyboard"`
IsPersistent bool `json:"is_persistent,omitempty"`
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
Selective bool `json:"selective,omitempty"`
}
// ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.
func (i ReplyKeyboardMarkup) ImplementsReplyMarkup() {}
// ReplyKeyboardRemove is used to remove the current custom keyboard and display the default letter-keyboard.
// By default, custom keyboards are displayed until a new keyboard is sent by a bot.
// An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
// RemoveKeyboard MUST BE true.
type ReplyKeyboardRemove struct {
RemoveKeyboard bool `json:"remove_keyboard"`
Selective bool `json:"selective"`
}
// ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.
func (r ReplyKeyboardRemove) ImplementsReplyMarkup() {}
// InlineKeyboardButton represents a button in an inline keyboard.
type InlineKeyboardButton struct {
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
LoginURL *LoginURL `json:"login_url,omitempty"`
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
Text string `json:"text"`
CallbackData string `json:"callback_data,omitempty"`
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
URL string `json:"url,omitempty"`
Pay bool `json:"pay,omitempty"`
}
// InlineKeyboardMarkup represents an inline keyboard.
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard" query:"inline_keyboard"`
}
// ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.
func (i InlineKeyboardMarkup) ImplementsReplyMarkup() {}
// ForceReply is used to display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
// This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
type ForceReply struct {
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
ForceReply bool `json:"force_reply"`
Selective bool `json:"selective"`
}
// ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.
func (f ForceReply) ImplementsReplyMarkup() {}
// UpdateOptions contains the optional parameters used by the GetUpdates method.
type UpdateOptions struct {
AllowedUpdates []UpdateType `query:"allowed_updates"`
Offset int `query:"offset"`
Limit int `query:"limit"`
Timeout int `query:"timeout"`
}
// WebhookOptions contains the optional parameters used by the SetWebhook method.
type WebhookOptions struct {
IPAddress string `query:"ip_address"`
SecretToken string `query:"secret_token"`
Certificate InputFile
AllowedUpdates []UpdateType `query:"allowed_updates"`
MaxConnections int `query:"max_connections"`
}
// BaseOptions contains the optional parameters used frequently in some Telegram API methods.
type BaseOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ReplyMarkup ReplyMarkup `query:"reply_markup"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// MessageOptions contains the optional parameters used by some Telegram API methods.
type MessageOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
LinkPreviewOptions LinkPreviewOptions `query:"link_preview_options"`
Entities []MessageEntity `query:"entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int64 `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// PinMessageOptions contains the optional parameters used by the PinChatMember method.
type PinMessageOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
DisableNotification bool `query:"disable_notification"`
}
// UnpinMessageOptions contains the optional parameters used by the UnpinChatMember method.
type UnpinMessageOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
MessageID int `query:"message_id"`
}
// ForwardOptions contains the optional parameters used by the ForwardMessage method.
type ForwardOptions struct {
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// CopyOptions contains the optional parameters used by the CopyMessage method.
type CopyOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
}
// CopyMessagesOptions contains the optional parameters used by the CopyMessages methods.
type CopyMessagesOptions struct {
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
RemoveCaption bool `query:"remove_caption"`
}
// StickerOptions contains the optional parameters used by the SendSticker method.
type StickerOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
Emoji string `query:"emoji"`
MessageEffectID string `query:"message_effect_id"`
ReplyMarkup ReplyMarkup `query:"reply_markup"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// InputFile is a struct which contains data about a file to be sent.
type InputFile struct {
id string
path string
url string
content []byte
}
// NewInputFileID is a wrapper for InputFile which only fills the id field.
func NewInputFileID(ID string) InputFile {
return InputFile{id: ID}
}
// NewInputFilePath is a wrapper for InputFile which only fills the path field.
func NewInputFilePath(filePath string) InputFile {
return InputFile{path: filePath}
}
// NewInputFileURL is a wrapper for InputFile which only fills the url field.
func NewInputFileURL(url string) InputFile {
return InputFile{url: url}
}
// NewInputFileBytes is a wrapper for InputFile which only fills the path and content fields.
func NewInputFileBytes(fileName string, content []byte) InputFile {
return InputFile{path: fileName, content: content}
}
// PhotoOptions contains the optional parameters used by the SendPhoto method.
type PhotoOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
HasSpoiler bool `query:"has_spoiler"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
}
// AudioOptions contains the optional parameters used by the SendAudio method.
type AudioOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
Title string `query:"title"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
Performer string `query:"performer"`
BusinessConnectionID string `query:"business_connection_id"`
Thumbnail InputFile
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
Duration int `query:"duration"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// DocumentOptions contains the optional parameters used by the SendDocument method.
type DocumentOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
Thumbnail InputFile
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
DisableContentTypeDetection bool `query:"disable_content_type_detection"`
}
// VideoOptions contains the optional parameters used by the SendVideo method.
type VideoOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
Caption string `query:"caption"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Thumbnail InputFile
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
Duration int `query:"duration"`
Width int `query:"width"`
Height int `query:"height"`
HasSpoiler bool `query:"has_spoiler"`
SupportsStreaming bool `query:"supports_streaming"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
}
// AnimationOptions contains the optional parameters used by the SendAnimation method.
type AnimationOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
Thumbnail InputFile
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
Duration int `query:"duration"`
Width int `query:"width"`
Height int `query:"height"`
HasSpoiler bool `query:"has_spoiler"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
}
// VoiceOptions contains the optional parameters used by the SendVoice method.
type VoiceOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ParseMode ParseMode `query:"parse_mode"`
Caption string `query:"caption"`
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
Duration int `query:"duration"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// VideoNoteOptions contains the optional parameters used by the SendVideoNote method.
type VideoNoteOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
Thumbnail InputFile
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
Duration int `query:"duration"`
Length int `query:"length"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// PaidMediaOptions contains the optional parameters used by the SendPaidMedia method.
type PaidMediaOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
Caption string `query:"caption"`
Payload string `query:"payload"`
ParseMode ParseMode `query:"parse_mode"`
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// MediaGroupOptions contains the optional parameters used by the SendMediaGroup method.
type MediaGroupOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// This is a custom constant to set an infinite live period value in LocationOptions and EditLocationOptions.
const InfiniteLivePeriod = 0x7FFFFFFF
// LocationOptions contains the optional parameters used by the SendLocation method.
type LocationOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
MessageEffectID string `query:"message_effect_id"`
ReplyMarkup ReplyMarkup `query:"reply_markup"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
HorizontalAccuracy float64 `query:"horizontal_accuracy"`
MessageThreadID int `query:"message_thread_id"`
LivePeriod int `query:"live_period"`
ProximityAlertRadius int `query:"proximity_alert_radius"`
Heading int `query:"heading"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// EditLocationOptions contains the optional parameters used by the EditMessageLiveLocation method.
type EditLocationOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
HorizontalAccuracy float64 `query:"horizontal_accuracy"`
Heading int `query:"heading"`
LivePeriod int `query:"live_period"`
ProximityAlertRadius int `query:"proximity_alert_radius"`
}
// StopLocationOptions contains the optional parameters used by the StopMessageLiveLocation method.
type StopLocationOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
}
// VenueOptions contains the optional parameters used by the SendVenue method.
type VenueOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
FoursquareID string `query:"foursquare_id"`
FoursquareType string `query:"foursquare_type"`
GooglePlaceType string `query:"google_place_type"`
GooglePlaceID string `query:"google_place_id"`
MessageEffectID string `query:"message_effect_id"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// ContactOptions contains the optional parameters used by the SendContact method.
type ContactOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
VCard string `query:"vcard"`
LastName string `query:"last_name"`
MessageEffectID string `query:"message_effect_id"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MessageThreadID int `query:"message_thread_id"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
}
// PollOptions contains the optional parameters used by the SendPoll method.
type PollOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
Explanation string `query:"explanation"`
MessageEffectID string `query:"message_effect_id"`
ExplanationParseMode ParseMode `query:"explanation_parse_mode"`
QuestionParseMode ParseMode `query:"question_parse_mode"`
Type PollType `query:"type"`
ExplanationEntities []MessageEntity `query:"explanation_entities"`
QuestionEntities []MessageEntity `query:"question_entities"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
CorrectOptionID int `query:"correct_option_id"`
MessageThreadID int `query:"message_thread_id"`
CloseDate int `query:"close_date"`
OpenPeriod int `query:"open_period"`
IsClosed bool `query:"is_closed"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
AllowsMultipleAnswers bool `query:"allows_multiple_answers"`
IsAnonymous bool `query:"is_anonymous"`
}
// StopPollOptions contains the optional parameters used by the StopPoll method.
type StopPollOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
}
// BanOptions contains the optional parameters used by the BanChatMember method.
type BanOptions struct {
UntilDate int `query:"until_date"`
RevokeMessages bool `query:"revoke_messages"`
}
// UnbanOptions contains the optional parameters used by the UnbanChatMember method.
type UnbanOptions struct {
OnlyIfBanned bool `query:"only_if_banned"`
}
// RestrictOptions contains the optional parameters used by the RestrictChatMember method.
type RestrictOptions struct {
UseIndependentChatPermissions bool `query:"use_independent_chat_permissions"`
UntilDate int `query:"until_date"`
}
// PromoteOptions contains the optional parameters used by the PromoteChatMember method.
type PromoteOptions struct {
IsAnonymous bool `query:"is_anonymous,omitempty"`
CanManageChat bool `query:"can_manage_chat,omitempty"`
CanPostMessages bool `query:"can_post_messages,omitempty"`
CanEditMessages bool `query:"can_edit_messages,omitempty"`
CanDeleteMessages bool `query:"can_delete_messages,omitempty"`
CanManageVideoChats bool `query:"can_manage_video_chats,omitempty"`
CanRestrictMembers bool `query:"can_restrict_members,omitempty"`
CanPromoteMembers bool `query:"can_promote_members,omitempty"`
CanChangeInfo bool `query:"can_change_info,omitempty"`
CanInviteUsers bool `query:"can_invite_users,omitempty"`
CanPinMessages bool `query:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `query:"can_manage_topics,omitempty"`
}
// UserProfileOptions contains the optional parameters used by the GetUserProfilePhotos method.
type UserProfileOptions struct {
Offset int `query:"offset"`
Limit int `query:"limit"`
}
// ChatPermissionsOptions contains the optional parameters used by the SetChatPermissions method.
type ChatPermissionsOptions struct {
UseIndependentChatPermissions bool `query:"use_independent_chat_permissions"`
}
// InviteLinkOptions contains the optional parameters used by the CreateChatInviteLink and EditChatInviteLink methods.
type InviteLinkOptions struct {
Name string `query:"name"`
ExpireDate int64 `query:"expire_date"`
MemberLimit int `query:"member_limit"`
CreatesJoinRequest bool `query:"creates_join_request"`
}
// ChatSubscriptionInviteOptions contains the optional parameters used by the CreateChatSubscriptionInviteLink and EditChatSubscriptionInviteLink methods.
type ChatSubscriptionInviteOptions struct {
Name string `query:"name"`
}
// CallbackQueryOptions contains the optional parameters used by the AnswerCallbackQuery method.
type CallbackQueryOptions struct {
Text string `query:"text"`
URL string `query:"url"`
CacheTime int `query:"cache_time"`
ShowAlert bool `query:"show_alert"`
}
// MessageIDOptions is a struct which contains data about a message to edit.
type MessageIDOptions struct {
inlineMessageID string `query:"inline_message_id"`
chatID int64 `query:"chat_id"`
messageID int `query:"message_id"`
}
// NewMessageID is a wrapper for MessageIDOptions which only fills the chatID and messageID fields.
func NewMessageID(chatID int64, messageID int) MessageIDOptions {
return MessageIDOptions{chatID: chatID, messageID: messageID}
}
// NewInlineMessageID is a wrapper for MessageIDOptions which only fills the inlineMessageID fields.
func NewInlineMessageID(ID string) MessageIDOptions {
return MessageIDOptions{inlineMessageID: ID}
}
// MessageTextOptions contains the optional parameters used by the EditMessageText method.
type MessageTextOptions struct {
ParseMode ParseMode `query:"parse_mode"`
BusinessConnectionID string `query:"business_connection_id"`
Entities []MessageEntity `query:"entities"`
ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
LinkPreviewOptions LinkPreviewOptions `query:"link_preview_options"`
}
// MessageCaptionOptions contains the optional parameters used by the EditMessageCaption method.
type MessageCaptionOptions struct {
Caption string `query:"caption"`
BusinessConnectionID string `query:"business_connection_id"`
ParseMode ParseMode `query:"parse_mode"`
CaptionEntities []MessageEntity `query:"caption_entities"`
ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
ShowCaptionAboveMedia bool `query:"show_caption_above_media"`
}
// MessageMediaOptions contains the optional parameters used by the EditMessageMedia method.
type MessageMediaOptions struct {
ReplyMarkup ReplyMarkup `query:"reply_markup"`
BusinessConnectionID string `query:"business_connection_id"`
}
// MessageReplyMarkupOptions contains the optional parameters used by the EditMessageReplyMarkup method.
type MessageReplyMarkupOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
}
// CommandOptions contains the optional parameters used by the SetMyCommands, DeleteMyCommands and GetMyCommands methods.
type CommandOptions struct {
LanguageCode string `query:"language_code"`
Scope BotCommandScope `query:"scope"`
}
// InvoiceOptions contains the optional parameters used by the SendInvoice API method.
type InvoiceOptions struct {
StartParameter string `query:"start_parameter"`
ProviderData string `query:"provider_data"`
PhotoURL string `query:"photo_url"`
ProviderToken string `query:"provider_token"`
MessageEffectID string `query:"message_effect_id"`
ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
SuggestedTipAmount []int `query:"suggested_tip_amounts"`
ReplyParameters ReplyParameters `query:"reply_parameters"`
MaxTipAmount int `query:"max_tip_amount"`
PhotoSize int `query:"photo_size"`
PhotoWidth int `query:"photo_width"`
PhotoHeight int `query:"photo_height"`
MessageThreadID int `query:"message_thread_id"`
SendPhoneNumberToProvider bool `query:"send_phone_number_to_provider"`
NeepShippingAddress bool `query:"need_shipping_address"`
NeedPhoneNumber bool `query:"need_phone_number"`
SendEmailToProvider bool `query:"send_email_to_provider"`
IsFlexible bool `query:"is_flexible"`
DisableNotification bool `query:"disable_notification"`
ProtectContent bool `query:"protect_content"`
NeedName bool `query:"need_name"`
NeedEmail bool `query:"need_email"`
}
// CreateInvoiceLinkOptions contains the optional parameters used by the CreateInvoiceLink API method.
type CreateInvoiceLinkOptions struct {
ProviderData string `query:"provider_data"`
PhotoURL string `query:"photo_url"`
ProviderToken string `query:"provider_token"`
SuggestedTipAmounts []int `query:"suggested_tip_amounts"`
PhotoSize int `query:"photo_size"`
PhotoWidth int `query:"photo_width"`
PhotoHeight int `query:"photo_height"`
MaxTipAmount int `query:"max_tip_amount"`
NeedPhoneNumber bool `query:"need_phone_number"`
NeepShippingAddress bool `query:"need_shipping_address"`
SendPhoneNumberToProvider bool `query:"send_phone_number_to_provider"`
SendEmailToProvider bool `query:"send_email_to_provider"`
IsFlexible bool `query:"is_flexible"`
NeedName bool `query:"need_name"`
NeedEmail bool `query:"need_email"`
}
// ShippingOption represents one shipping option.
type ShippingOption struct {
ID string `query:"id"`
Title string `query:"title"`
Prices []LabeledPrice `query:"prices"`
}
// ShippingQueryOptions contains the optional parameters used by the AnswerShippingQuery API method.
type ShippingQueryOptions struct {
ErrorMessage string `query:"error_message"`
ShippingOptions []ShippingOption `query:"shipping_options"`
}
// PreCheckoutOptions contains the optional parameters used by the AnswerPreCheckoutQuery API method.
type PreCheckoutOptions struct {
ErrorMessage string `query:"error_message"`
}
// CreateTopicOptions contains the optional parameters used by the CreateForumTopic API method.
type CreateTopicOptions struct {
IconCustomEmojiID string `query:"icon_custom_emoji_id"`
IconColor IconColor `query:"icon_color"`
}
// EditTopicOptions contains the optional parameters used by the EditForumTopic API method.
type EditTopicOptions struct {
Name string `query:"name"`
IconCustomEmojiID string `query:"icon_custom_emoji_id"`
}
// ChatActionOptions contains the optional parameters used by the SendChatAction API method.
type ChatActionOptions struct {
BusinessConnectionID string `query:"business_connection_id"`
MessageThreadID int `query:"message_thread_id"`
}
// MessageReactionOptions contains the optional parameters used by the SetMessageReaction API method.
type MessageReactionOptions struct {
Reaction []ReactionType `query:"reaction"`
IsBig bool `query:"is_big"`
}