· 5 years ago · Feb 24, 2020, 10:02 PM
1// Code in this file was generated. DO NOT EDIT.
2// Source: https://core.telegram.org/bots/api
3// Generator: https://gitlab.com/crosscone/lib/tgbot
4
5package tg
6
7// ReplyMarkup - This object represents reply markup.
8type ReplyMarkup interface {
9 ReplyMarkup()
10}
11
12// ChatID - This object represents chat id.
13type ChatID interface {
14 ChatID()
15}
16
17// InputMedia - This object represents the content of a media message to be sent. It should be one of
18type InputMedia interface {
19 InputMedia()
20}
21
22// InlineQueryResult - This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
23type InlineQueryResult interface {
24 InlineQueryResult()
25}
26
27// InputMessageContent - This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 4 types:
28type InputMessageContent interface {
29 InputMessageContent()
30}
31
32// PassportElementError - This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
33type PassportElementError interface {
34 PassportElementError()
35}
36
37// Update - This object represents an incoming update.At most one of the optional parameters can be present in any given update.
38type Update struct {
39 UpdateID int `json:"update_id"`
40 Message *Message `json:"message"`
41 EditedMessage *Message `json:"edited_message"`
42 ChannelPost *Message `json:"channel_post"`
43 EditedChannelPost *Message `json:"edited_channel_post"`
44 InlineQuery *InlineQuery `json:"inline_query"`
45 ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
46 CallbackQuery *CallbackQuery `json:"callback_query"`
47 ShippingQuery *ShippingQuery `json:"shipping_query"`
48 PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
49 Poll *Poll `json:"poll"`
50 PollAnswer *PollAnswer `json:"poll_answer"`
51}
52
53// WebhookInfo - Contains information about the current status of a webhook.
54type WebhookInfo struct {
55 URL string `json:"url"`
56 HasCustomCertificate bool `json:"has_custom_certificate"`
57 PendingUpdateCount int `json:"pending_update_count"`
58 LastErrorDate int `json:"last_error_date"`
59 LastErrorMessage string `json:"last_error_message"`
60 MaxConnections int `json:"max_connections"`
61 AllowedUpdates []string `json:"allowed_updates"`
62}
63
64// User - This object represents a Telegram user or bot.
65type User struct {
66 ID int `json:"id"`
67 IsBot bool `json:"is_bot"`
68 FirstName string `json:"first_name"`
69 LastName string `json:"last_name"`
70 Username string `json:"username"`
71 LanguageCode string `json:"language_code"`
72 CanJoinGroups bool `json:"can_join_groups"`
73 CanReadAllGroupMessages bool `json:"can_read_all_group_messages"`
74 SupportsInlineQueries bool `json:"supports_inline_queries"`
75}
76
77// Chat - This object represents a chat.
78type Chat struct {
79 ID int64 `json:"id"`
80 Type string `json:"type"`
81 Title string `json:"title"`
82 Username string `json:"username"`
83 FirstName string `json:"first_name"`
84 LastName string `json:"last_name"`
85 Photo *ChatPhoto `json:"photo"`
86 Description string `json:"description"`
87 InviteLink string `json:"invite_link"`
88 PinnedMessage *Message `json:"pinned_message"`
89 Permissions *ChatPermissions `json:"permissions"`
90 SlowModeDelay int `json:"slow_mode_delay"`
91 StickerSetName string `json:"sticker_set_name"`
92 CanSetStickerSet bool `json:"can_set_sticker_set"`
93}
94
95// Message - This object represents a message.
96type Message struct {
97 MessageID int `json:"message_id"`
98 From *User `json:"from"`
99 Date int `json:"date"`
100 Chat *Chat `json:"chat"`
101 ForwardFrom *User `json:"forward_from"`
102 ForwardFromChat *Chat `json:"forward_from_chat"`
103 ForwardFromMessageID int `json:"forward_from_message_id"`
104 ForwardSignature string `json:"forward_signature"`
105 ForwardSenderName string `json:"forward_sender_name"`
106 ForwardDate int `json:"forward_date"`
107 ReplyToMessage *Message `json:"reply_to_message"`
108 EditDate int `json:"edit_date"`
109 MediaGroupID string `json:"media_group_id"`
110 AuthorSignature string `json:"author_signature"`
111 Text string `json:"text"`
112 Entities []*MessageEntity `json:"entities"`
113 CaptionEntities []*MessageEntity `json:"caption_entities"`
114 Audio *Audio `json:"audio"`
115 Document *Document `json:"document"`
116 Animation *Animation `json:"animation"`
117 Game *Game `json:"game"`
118 Photo []*PhotoSize `json:"photo"`
119 Sticker *Sticker `json:"sticker"`
120 Video *Video `json:"video"`
121 Voice *Voice `json:"voice"`
122 VideoNote *VideoNote `json:"video_note"`
123 Caption string `json:"caption"`
124 Contact *Contact `json:"contact"`
125 Location *Location `json:"location"`
126 Venue *Venue `json:"venue"`
127 Poll *Poll `json:"poll"`
128 NewChatMembers []*User `json:"new_chat_members"`
129 LeftChatMember *User `json:"left_chat_member"`
130 NewChatTitle string `json:"new_chat_title"`
131 NewChatPhoto []*PhotoSize `json:"new_chat_photo"`
132 DeleteChatPhoto bool `json:"delete_chat_photo"`
133 GroupChatCreated bool `json:"group_chat_created"`
134 SupergroupChatCreated bool `json:"supergroup_chat_created"`
135 ChannelChatCreated bool `json:"channel_chat_created"`
136 MigrateToChatID int64 `json:"migrate_to_chat_id"`
137 MigrateFromChatID int64 `json:"migrate_from_chat_id"`
138 PinnedMessage *Message `json:"pinned_message"`
139 Invoice *Invoice `json:"invoice"`
140 SuccessfulPayment *SuccessfulPayment `json:"successful_payment"`
141 ConnectedWebsite string `json:"connected_website"`
142 PassportData *PassportData `json:"passport_data"`
143 ReplyMarkup ReplyMarkup `json:"reply_markup"`
144}
145
146// MessageEntity - This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
147type MessageEntity struct {
148 Type string `json:"type"`
149 Offset int `json:"offset"`
150 Length int `json:"length"`
151 URL string `json:"url"`
152 User *User `json:"user"`
153 Language string `json:"language"`
154}
155
156// PhotoSize - This object represents one size of a photo or a file / sticker thumbnail.
157type PhotoSize struct {
158 FileID string `json:"file_id"`
159 FileUniqueID string `json:"file_unique_id"`
160 Width int `json:"width"`
161 Height int `json:"height"`
162 FileSize int `json:"file_size"`
163}
164
165// Audio - This object represents an audio file to be treated as music by the Telegram clients.
166type Audio struct {
167 FileID string `json:"file_id"`
168 FileUniqueID string `json:"file_unique_id"`
169 Duration int `json:"duration"`
170 Performer string `json:"performer"`
171 Title string `json:"title"`
172 MimeType string `json:"mime_type"`
173 FileSize int `json:"file_size"`
174 Thumb *PhotoSize `json:"thumb"`
175}
176
177// Document - This object represents a general file (as opposed to photos, voice messages and audio files).
178type Document struct {
179 FileID string `json:"file_id"`
180 FileUniqueID string `json:"file_unique_id"`
181 Thumb *PhotoSize `json:"thumb"`
182 FileName string `json:"file_name"`
183 MimeType string `json:"mime_type"`
184 FileSize int `json:"file_size"`
185}
186
187// Video - This object represents a video file.
188type Video struct {
189 FileID string `json:"file_id"`
190 FileUniqueID string `json:"file_unique_id"`
191 Width int `json:"width"`
192 Height int `json:"height"`
193 Duration int `json:"duration"`
194 Thumb *PhotoSize `json:"thumb"`
195 MimeType string `json:"mime_type"`
196 FileSize int `json:"file_size"`
197}
198
199// Animation - This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
200type Animation struct {
201 FileID string `json:"file_id"`
202 FileUniqueID string `json:"file_unique_id"`
203 Width int `json:"width"`
204 Height int `json:"height"`
205 Duration int `json:"duration"`
206 Thumb *PhotoSize `json:"thumb"`
207 FileName string `json:"file_name"`
208 MimeType string `json:"mime_type"`
209 FileSize int `json:"file_size"`
210}
211
212// Voice - This object represents a voice note.
213type Voice struct {
214 FileID string `json:"file_id"`
215 FileUniqueID string `json:"file_unique_id"`
216 Duration int `json:"duration"`
217 MimeType string `json:"mime_type"`
218 FileSize int `json:"file_size"`
219}
220
221// VideoNote - This object represents a video message (available in Telegram apps as of v.4.0).
222type VideoNote struct {
223 FileID string `json:"file_id"`
224 FileUniqueID string `json:"file_unique_id"`
225 Length int `json:"length"`
226 Duration int `json:"duration"`
227 Thumb *PhotoSize `json:"thumb"`
228 FileSize int `json:"file_size"`
229}
230
231// Contact - This object represents a phone contact.
232type Contact struct {
233 PhoneNumber string `json:"phone_number"`
234 FirstName string `json:"first_name"`
235 LastName string `json:"last_name"`
236 UserID int `json:"user_id"`
237 Vcard string `json:"vcard"`
238}
239
240// Location - This object represents a point on the map.
241type Location struct {
242 Longitude float64 `json:"longitude"`
243 Latitude float64 `json:"latitude"`
244}
245
246// Venue - This object represents a venue.
247type Venue struct {
248 Location *Location `json:"location"`
249 Title string `json:"title"`
250 Address string `json:"address"`
251 FoursquareID string `json:"foursquare_id"`
252 FoursquareType string `json:"foursquare_type"`
253}
254
255// PollOption - This object contains information about one answer option in a poll.
256type PollOption struct {
257 Text string `json:"text"`
258 VoterCount int `json:"voter_count"`
259}
260
261// PollAnswer - This object represents an answer of a user in a non-anonymous poll.
262type PollAnswer struct {
263 PollID string `json:"poll_id"`
264 User *User `json:"user"`
265 OptionIds []int `json:"option_ids"`
266}
267
268// Poll - This object contains information about a poll.
269type Poll struct {
270 ID string `json:"id"`
271 Question string `json:"question"`
272 Options []*PollOption `json:"options"`
273 TotalVoterCount int `json:"total_voter_count"`
274 IsClosed bool `json:"is_closed"`
275 IsAnonymous bool `json:"is_anonymous"`
276 Type string `json:"type"`
277 AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
278 CorrectOptionID int `json:"correct_option_id"`
279}
280
281// UserProfilePhotos - This object represent a user's profile pictures.
282type UserProfilePhotos struct {
283 TotalCount int `json:"total_count"`
284 Photos [][]*PhotoSize `json:"photos"`
285}
286
287// File - This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
288type File struct {
289 FileID string `json:"file_id"`
290 FileUniqueID string `json:"file_unique_id"`
291 FileSize int `json:"file_size"`
292 FilePath string `json:"file_path"`
293}
294
295// ReplyKeyboardMarkup - This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
296type ReplyKeyboardMarkup struct {
297 Keyboard [][]*KeyboardButton `json:"keyboard"`
298 ResizeKeyboard bool `json:"resize_keyboard"`
299 OneTimeKeyboard bool `json:"one_time_keyboard"`
300 Selective bool `json:"selective"`
301}
302
303// KeyboardButton - This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.
304type KeyboardButton struct {
305 Text string `json:"text"`
306 RequestContact bool `json:"request_contact"`
307 RequestLocation bool `json:"request_location"`
308 RequestPoll *KeyboardButtonPollType `json:"request_poll"`
309}
310
311// KeyboardButtonPollType - This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
312type KeyboardButtonPollType struct {
313 Type string `json:"type"`
314}
315
316// ReplyKeyboardRemove - Upon receiving a message with this object, Telegram clients will 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).
317type ReplyKeyboardRemove struct {
318 RemoveKeyboard bool `json:"remove_keyboard"`
319 Selective bool `json:"selective"`
320}
321
322// InlineKeyboardMarkup - This object represents an inline keyboard that appears right next to the message it belongs to.
323type InlineKeyboardMarkup struct {
324 InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"`
325}
326
327// InlineKeyboardButton - This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
328type InlineKeyboardButton struct {
329 Text string `json:"text"`
330 URL string `json:"url"`
331 LoginURL *LoginURL `json:"login_url"`
332 CallbackData string `json:"callback_data"`
333 SwitchInlineQuery string `json:"switch_inline_query"`
334 SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat"`
335 CallbackGame *CallbackGame `json:"callback_game"`
336 Pay bool `json:"pay"`
337}
338
339// LoginURL - This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
340type LoginURL struct {
341 URL string `json:"url"`
342 ForwardText string `json:"forward_text"`
343 BotUsername string `json:"bot_username"`
344 RequestWriteAccess bool `json:"request_write_access"`
345}
346
347// CallbackQuery - This object 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.
348type CallbackQuery struct {
349 ID string `json:"id"`
350 From *User `json:"from"`
351 Message *Message `json:"message"`
352 InlineMessageID string `json:"inline_message_id"`
353 ChatInstance string `json:"chat_instance"`
354 Data string `json:"data"`
355 GameShortName string `json:"game_short_name"`
356}
357
358// ForceReply - Upon receiving a message with this object, Telegram clients will 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.
359type ForceReply struct {
360 ForceReply bool `json:"force_reply"`
361 Selective bool `json:"selective"`
362}
363
364// ChatPhoto - This object represents a chat photo.
365type ChatPhoto struct {
366 SmallFileID string `json:"small_file_id"`
367 SmallFileUniqueID string `json:"small_file_unique_id"`
368 BigFileID string `json:"big_file_id"`
369 BigFileUniqueID string `json:"big_file_unique_id"`
370}
371
372// ChatMember - This object contains information about one member of a chat.
373type ChatMember struct {
374 User *User `json:"user"`
375 Status string `json:"status"`
376 CustomTitle string `json:"custom_title"`
377 UntilDate int `json:"until_date"`
378 CanBeEdited bool `json:"can_be_edited"`
379 CanPostMessages bool `json:"can_post_messages"`
380 CanEditMessages bool `json:"can_edit_messages"`
381 CanDeleteMessages bool `json:"can_delete_messages"`
382 CanRestrictMembers bool `json:"can_restrict_members"`
383 CanPromoteMembers bool `json:"can_promote_members"`
384 CanChangeInfo bool `json:"can_change_info"`
385 CanInviteUsers bool `json:"can_invite_users"`
386 CanPinMessages bool `json:"can_pin_messages"`
387 IsMember bool `json:"is_member"`
388 CanSendMessages bool `json:"can_send_messages"`
389 CanSendMediaMessages bool `json:"can_send_media_messages"`
390 CanSendPolls bool `json:"can_send_polls"`
391 CanSendOtherMessages bool `json:"can_send_other_messages"`
392 CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`
393}
394
395// ChatPermissions - Describes actions that a non-administrator user is allowed to take in a chat.
396type ChatPermissions struct {
397 CanSendMessages bool `json:"can_send_messages"`
398 CanSendMediaMessages bool `json:"can_send_media_messages"`
399 CanSendPolls bool `json:"can_send_polls"`
400 CanSendOtherMessages bool `json:"can_send_other_messages"`
401 CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`
402 CanChangeInfo bool `json:"can_change_info"`
403 CanInviteUsers bool `json:"can_invite_users"`
404 CanPinMessages bool `json:"can_pin_messages"`
405}
406
407// ResponseParameters - Contains information about why a request was unsuccessful.
408type ResponseParameters struct {
409 MigrateToChatID int64 `json:"migrate_to_chat_id"`
410 RetryAfter int `json:"retry_after"`
411}
412
413// InputMediaPhoto - Represents a photo to be sent.
414type InputMediaPhoto struct {
415 Type string `json:"type"`
416 Media string `json:"media"`
417 Caption string `json:"caption"`
418 ParseMode string `json:"parse_mode"`
419}
420
421// InputMediaVideo - Represents a video to be sent.
422type InputMediaVideo struct {
423 Type string `json:"type"`
424 Media string `json:"media"`
425 Thumb InputFile `json:"thumb"`
426 Caption string `json:"caption"`
427 ParseMode string `json:"parse_mode"`
428 Width int `json:"width"`
429 Height int `json:"height"`
430 Duration int `json:"duration"`
431 SupportsStreaming bool `json:"supports_streaming"`
432}
433
434// InputMediaAnimation - Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
435type InputMediaAnimation struct {
436 Type string `json:"type"`
437 Media string `json:"media"`
438 Thumb InputFile `json:"thumb"`
439 Caption string `json:"caption"`
440 ParseMode string `json:"parse_mode"`
441 Width int `json:"width"`
442 Height int `json:"height"`
443 Duration int `json:"duration"`
444}
445
446// InputMediaAudio - Represents an audio file to be treated as music to be sent.
447type InputMediaAudio struct {
448 Type string `json:"type"`
449 Media string `json:"media"`
450 Thumb InputFile `json:"thumb"`
451 Caption string `json:"caption"`
452 ParseMode string `json:"parse_mode"`
453 Duration int `json:"duration"`
454 Performer string `json:"performer"`
455 Title string `json:"title"`
456}
457
458// InputMediaDocument - Represents a general file to be sent.
459type InputMediaDocument struct {
460 Type string `json:"type"`
461 Media string `json:"media"`
462 Thumb InputFile `json:"thumb"`
463 Caption string `json:"caption"`
464 ParseMode string `json:"parse_mode"`
465}
466
467// InputFile - This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
468type InputFile struct {
469}
470
471// Sticker - This object represents a sticker.
472type Sticker struct {
473 FileID string `json:"file_id"`
474 FileUniqueID string `json:"file_unique_id"`
475 Width int `json:"width"`
476 Height int `json:"height"`
477 IsAnimated bool `json:"is_animated"`
478 Thumb *PhotoSize `json:"thumb"`
479 Emoji string `json:"emoji"`
480 SetName string `json:"set_name"`
481 MaskPosition *MaskPosition `json:"mask_position"`
482 FileSize int `json:"file_size"`
483}
484
485// StickerSet - This object represents a sticker set.
486type StickerSet struct {
487 Name string `json:"name"`
488 Title string `json:"title"`
489 IsAnimated bool `json:"is_animated"`
490 ContainsMasks bool `json:"contains_masks"`
491 Stickers []*Sticker `json:"stickers"`
492}
493
494// MaskPosition - This object describes the position on faces where a mask should be placed by default.
495type MaskPosition struct {
496 Point string `json:"point"`
497 XShift float64 `json:"x_shift"`
498 YShift float64 `json:"y_shift"`
499 Scale float64 `json:"scale"`
500}
501
502// InlineQuery - This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
503type InlineQuery struct {
504 ID string `json:"id"`
505 From *User `json:"from"`
506 Location *Location `json:"location"`
507 Query string `json:"query"`
508 Offset string `json:"offset"`
509}
510
511// InlineQueryResultArticle - Represents a link to an article or web page.
512type InlineQueryResultArticle struct {
513 Type string `json:"type"`
514 ID string `json:"id"`
515 Title string `json:"title"`
516 InputMessageContent *InputMessageContent `json:"input_message_content"`
517 ReplyMarkup ReplyMarkup `json:"reply_markup"`
518 URL string `json:"url"`
519 HideURL bool `json:"hide_url"`
520 Description string `json:"description"`
521 ThumbURL string `json:"thumb_url"`
522 ThumbWidth int `json:"thumb_width"`
523 ThumbHeight int `json:"thumb_height"`
524}
525
526// InlineQueryResultPhoto - Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
527type InlineQueryResultPhoto struct {
528 Type string `json:"type"`
529 ID string `json:"id"`
530 PhotoURL string `json:"photo_url"`
531 ThumbURL string `json:"thumb_url"`
532 PhotoWidth int `json:"photo_width"`
533 PhotoHeight int `json:"photo_height"`
534 Title string `json:"title"`
535 Description string `json:"description"`
536 Caption string `json:"caption"`
537 ParseMode string `json:"parse_mode"`
538 ReplyMarkup ReplyMarkup `json:"reply_markup"`
539 InputMessageContent *InputMessageContent `json:"input_message_content"`
540}
541
542// InlineQueryResultGif - Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
543type InlineQueryResultGif struct {
544 Type string `json:"type"`
545 ID string `json:"id"`
546 GifURL string `json:"gif_url"`
547 GifWidth int `json:"gif_width"`
548 GifHeight int `json:"gif_height"`
549 GifDuration int `json:"gif_duration"`
550 ThumbURL string `json:"thumb_url"`
551 Title string `json:"title"`
552 Caption string `json:"caption"`
553 ParseMode string `json:"parse_mode"`
554 ReplyMarkup ReplyMarkup `json:"reply_markup"`
555 InputMessageContent *InputMessageContent `json:"input_message_content"`
556}
557
558// InlineQueryResultMpeg4Gif - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
559type InlineQueryResultMpeg4Gif struct {
560 Type string `json:"type"`
561 ID string `json:"id"`
562 Mpeg4URL string `json:"mpeg4_url"`
563 Mpeg4Width int `json:"mpeg4_width"`
564 Mpeg4Height int `json:"mpeg4_height"`
565 Mpeg4Duration int `json:"mpeg4_duration"`
566 ThumbURL string `json:"thumb_url"`
567 Title string `json:"title"`
568 Caption string `json:"caption"`
569 ParseMode string `json:"parse_mode"`
570 ReplyMarkup ReplyMarkup `json:"reply_markup"`
571 InputMessageContent *InputMessageContent `json:"input_message_content"`
572}
573
574// InlineQueryResultVideo - Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
575type InlineQueryResultVideo struct {
576 Type string `json:"type"`
577 ID string `json:"id"`
578 VideoURL string `json:"video_url"`
579 MimeType string `json:"mime_type"`
580 ThumbURL string `json:"thumb_url"`
581 Title string `json:"title"`
582 Caption string `json:"caption"`
583 ParseMode string `json:"parse_mode"`
584 VideoWidth int `json:"video_width"`
585 VideoHeight int `json:"video_height"`
586 VideoDuration int `json:"video_duration"`
587 Description string `json:"description"`
588 ReplyMarkup ReplyMarkup `json:"reply_markup"`
589 InputMessageContent *InputMessageContent `json:"input_message_content"`
590}
591
592// InlineQueryResultAudio - Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
593type InlineQueryResultAudio struct {
594 Type string `json:"type"`
595 ID string `json:"id"`
596 AudioURL string `json:"audio_url"`
597 Title string `json:"title"`
598 Caption string `json:"caption"`
599 ParseMode string `json:"parse_mode"`
600 Performer string `json:"performer"`
601 AudioDuration int `json:"audio_duration"`
602 ReplyMarkup ReplyMarkup `json:"reply_markup"`
603 InputMessageContent *InputMessageContent `json:"input_message_content"`
604}
605
606// InlineQueryResultVoice - Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
607type InlineQueryResultVoice struct {
608 Type string `json:"type"`
609 ID string `json:"id"`
610 VoiceURL string `json:"voice_url"`
611 Title string `json:"title"`
612 Caption string `json:"caption"`
613 ParseMode string `json:"parse_mode"`
614 VoiceDuration int `json:"voice_duration"`
615 ReplyMarkup ReplyMarkup `json:"reply_markup"`
616 InputMessageContent *InputMessageContent `json:"input_message_content"`
617}
618
619// InlineQueryResultDocument - Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
620type InlineQueryResultDocument struct {
621 Type string `json:"type"`
622 ID string `json:"id"`
623 Title string `json:"title"`
624 Caption string `json:"caption"`
625 ParseMode string `json:"parse_mode"`
626 DocumentURL string `json:"document_url"`
627 MimeType string `json:"mime_type"`
628 Description string `json:"description"`
629 ReplyMarkup ReplyMarkup `json:"reply_markup"`
630 InputMessageContent *InputMessageContent `json:"input_message_content"`
631 ThumbURL string `json:"thumb_url"`
632 ThumbWidth int `json:"thumb_width"`
633 ThumbHeight int `json:"thumb_height"`
634}
635
636// InlineQueryResultLocation - Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
637type InlineQueryResultLocation struct {
638 Type string `json:"type"`
639 ID string `json:"id"`
640 Latitude float64 `json:"latitude"`
641 Longitude float64 `json:"longitude"`
642 Title string `json:"title"`
643 LivePeriod int `json:"live_period"`
644 ReplyMarkup ReplyMarkup `json:"reply_markup"`
645 InputMessageContent *InputMessageContent `json:"input_message_content"`
646 ThumbURL string `json:"thumb_url"`
647 ThumbWidth int `json:"thumb_width"`
648 ThumbHeight int `json:"thumb_height"`
649}
650
651// InlineQueryResultVenue - Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
652type InlineQueryResultVenue struct {
653 Type string `json:"type"`
654 ID string `json:"id"`
655 Latitude float64 `json:"latitude"`
656 Longitude float64 `json:"longitude"`
657 Title string `json:"title"`
658 Address string `json:"address"`
659 FoursquareID string `json:"foursquare_id"`
660 FoursquareType string `json:"foursquare_type"`
661 ReplyMarkup ReplyMarkup `json:"reply_markup"`
662 InputMessageContent *InputMessageContent `json:"input_message_content"`
663 ThumbURL string `json:"thumb_url"`
664 ThumbWidth int `json:"thumb_width"`
665 ThumbHeight int `json:"thumb_height"`
666}
667
668// InlineQueryResultContact - Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
669type InlineQueryResultContact struct {
670 Type string `json:"type"`
671 ID string `json:"id"`
672 PhoneNumber string `json:"phone_number"`
673 FirstName string `json:"first_name"`
674 LastName string `json:"last_name"`
675 Vcard string `json:"vcard"`
676 ReplyMarkup ReplyMarkup `json:"reply_markup"`
677 InputMessageContent *InputMessageContent `json:"input_message_content"`
678 ThumbURL string `json:"thumb_url"`
679 ThumbWidth int `json:"thumb_width"`
680 ThumbHeight int `json:"thumb_height"`
681}
682
683// InlineQueryResultGame - Represents a Game.
684type InlineQueryResultGame struct {
685 Type string `json:"type"`
686 ID string `json:"id"`
687 GameShortName string `json:"game_short_name"`
688 ReplyMarkup ReplyMarkup `json:"reply_markup"`
689}
690
691// InlineQueryResultCachedPhoto - Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
692type InlineQueryResultCachedPhoto struct {
693 Type string `json:"type"`
694 ID string `json:"id"`
695 PhotoFileID string `json:"photo_file_id"`
696 Title string `json:"title"`
697 Description string `json:"description"`
698 Caption string `json:"caption"`
699 ParseMode string `json:"parse_mode"`
700 ReplyMarkup ReplyMarkup `json:"reply_markup"`
701 InputMessageContent *InputMessageContent `json:"input_message_content"`
702}
703
704// InlineQueryResultCachedGif - Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
705type InlineQueryResultCachedGif struct {
706 Type string `json:"type"`
707 ID string `json:"id"`
708 GifFileID string `json:"gif_file_id"`
709 Title string `json:"title"`
710 Caption string `json:"caption"`
711 ParseMode string `json:"parse_mode"`
712 ReplyMarkup ReplyMarkup `json:"reply_markup"`
713 InputMessageContent *InputMessageContent `json:"input_message_content"`
714}
715
716// InlineQueryResultCachedMpeg4Gif - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
717type InlineQueryResultCachedMpeg4Gif struct {
718 Type string `json:"type"`
719 ID string `json:"id"`
720 Mpeg4FileID string `json:"mpeg4_file_id"`
721 Title string `json:"title"`
722 Caption string `json:"caption"`
723 ParseMode string `json:"parse_mode"`
724 ReplyMarkup ReplyMarkup `json:"reply_markup"`
725 InputMessageContent *InputMessageContent `json:"input_message_content"`
726}
727
728// InlineQueryResultCachedSticker - Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
729type InlineQueryResultCachedSticker struct {
730 Type string `json:"type"`
731 ID string `json:"id"`
732 StickerFileID string `json:"sticker_file_id"`
733 ReplyMarkup ReplyMarkup `json:"reply_markup"`
734 InputMessageContent *InputMessageContent `json:"input_message_content"`
735}
736
737// InlineQueryResultCachedDocument - Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
738type InlineQueryResultCachedDocument struct {
739 Type string `json:"type"`
740 ID string `json:"id"`
741 Title string `json:"title"`
742 DocumentFileID string `json:"document_file_id"`
743 Description string `json:"description"`
744 Caption string `json:"caption"`
745 ParseMode string `json:"parse_mode"`
746 ReplyMarkup ReplyMarkup `json:"reply_markup"`
747 InputMessageContent *InputMessageContent `json:"input_message_content"`
748}
749
750// InlineQueryResultCachedVideo - Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
751type InlineQueryResultCachedVideo struct {
752 Type string `json:"type"`
753 ID string `json:"id"`
754 VideoFileID string `json:"video_file_id"`
755 Title string `json:"title"`
756 Description string `json:"description"`
757 Caption string `json:"caption"`
758 ParseMode string `json:"parse_mode"`
759 ReplyMarkup ReplyMarkup `json:"reply_markup"`
760 InputMessageContent *InputMessageContent `json:"input_message_content"`
761}
762
763// InlineQueryResultCachedVoice - Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
764type InlineQueryResultCachedVoice struct {
765 Type string `json:"type"`
766 ID string `json:"id"`
767 VoiceFileID string `json:"voice_file_id"`
768 Title string `json:"title"`
769 Caption string `json:"caption"`
770 ParseMode string `json:"parse_mode"`
771 ReplyMarkup ReplyMarkup `json:"reply_markup"`
772 InputMessageContent *InputMessageContent `json:"input_message_content"`
773}
774
775// InlineQueryResultCachedAudio - Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
776type InlineQueryResultCachedAudio struct {
777 Type string `json:"type"`
778 ID string `json:"id"`
779 AudioFileID string `json:"audio_file_id"`
780 Caption string `json:"caption"`
781 ParseMode string `json:"parse_mode"`
782 ReplyMarkup ReplyMarkup `json:"reply_markup"`
783 InputMessageContent *InputMessageContent `json:"input_message_content"`
784}
785
786// InputTextMessageContent - Represents the content of a text message to be sent as the result of an inline query.
787type InputTextMessageContent struct {
788 MessageText string `json:"message_text"`
789 ParseMode string `json:"parse_mode"`
790 DisableWebPagePreview bool `json:"disable_web_page_preview"`
791}
792
793// InputLocationMessageContent - Represents the content of a location message to be sent as the result of an inline query.
794type InputLocationMessageContent struct {
795 Latitude float64 `json:"latitude"`
796 Longitude float64 `json:"longitude"`
797 LivePeriod int `json:"live_period"`
798}
799
800// InputVenueMessageContent - Represents the content of a venue message to be sent as the result of an inline query.
801type InputVenueMessageContent struct {
802 Latitude float64 `json:"latitude"`
803 Longitude float64 `json:"longitude"`
804 Title string `json:"title"`
805 Address string `json:"address"`
806 FoursquareID string `json:"foursquare_id"`
807 FoursquareType string `json:"foursquare_type"`
808}
809
810// InputContactMessageContent - Represents the content of a contact message to be sent as the result of an inline query.
811type InputContactMessageContent struct {
812 PhoneNumber string `json:"phone_number"`
813 FirstName string `json:"first_name"`
814 LastName string `json:"last_name"`
815 Vcard string `json:"vcard"`
816}
817
818// ChosenInlineResult - Represents a result of an inline query that was chosen by the user and sent to their chat partner.
819type ChosenInlineResult struct {
820 ResultID string `json:"result_id"`
821 From *User `json:"from"`
822 Location *Location `json:"location"`
823 InlineMessageID string `json:"inline_message_id"`
824 Query string `json:"query"`
825}
826
827// LabeledPrice - This object represents a portion of the price for goods or services.
828type LabeledPrice struct {
829 Label string `json:"label"`
830 Amount int `json:"amount"`
831}
832
833// Invoice - This object contains basic information about an invoice.
834type Invoice struct {
835 Title string `json:"title"`
836 Description string `json:"description"`
837 StartParameter string `json:"start_parameter"`
838 Currency string `json:"currency"`
839 TotalAmount int `json:"total_amount"`
840}
841
842// ShippingAddress - This object represents a shipping address.
843type ShippingAddress struct {
844 CountryCode string `json:"country_code"`
845 State string `json:"state"`
846 City string `json:"city"`
847 StreetLine1 string `json:"street_line1"`
848 StreetLine2 string `json:"street_line2"`
849 PostCode string `json:"post_code"`
850}
851
852// OrderInfo - This object represents information about an order.
853type OrderInfo struct {
854 Name string `json:"name"`
855 PhoneNumber string `json:"phone_number"`
856 Email string `json:"email"`
857 ShippingAddress *ShippingAddress `json:"shipping_address"`
858}
859
860// ShippingOption - This object represents one shipping option.
861type ShippingOption struct {
862 ID string `json:"id"`
863 Title string `json:"title"`
864 Prices []*LabeledPrice `json:"prices"`
865}
866
867// SuccessfulPayment - This object contains basic information about a successful payment.
868type SuccessfulPayment struct {
869 Currency string `json:"currency"`
870 TotalAmount int `json:"total_amount"`
871 InvoicePayload string `json:"invoice_payload"`
872 ShippingOptionID string `json:"shipping_option_id"`
873 OrderInfo *OrderInfo `json:"order_info"`
874 TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
875 ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
876}
877
878// ShippingQuery - This object contains information about an incoming shipping query.
879type ShippingQuery struct {
880 ID string `json:"id"`
881 From *User `json:"from"`
882 InvoicePayload string `json:"invoice_payload"`
883 ShippingAddress *ShippingAddress `json:"shipping_address"`
884}
885
886// PreCheckoutQuery - This object contains information about an incoming pre-checkout query.
887type PreCheckoutQuery struct {
888 ID string `json:"id"`
889 From *User `json:"from"`
890 Currency string `json:"currency"`
891 TotalAmount int `json:"total_amount"`
892 InvoicePayload string `json:"invoice_payload"`
893 ShippingOptionID string `json:"shipping_option_id"`
894 OrderInfo *OrderInfo `json:"order_info"`
895}
896
897// PassportData - Contains information about Telegram Passport data shared with the bot by the user.
898type PassportData struct {
899 Data []*EncryptedPassportElement `json:"data"`
900 Credentials *EncryptedCredentials `json:"credentials"`
901}
902
903// PassportFile - This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
904type PassportFile struct {
905 FileID string `json:"file_id"`
906 FileUniqueID string `json:"file_unique_id"`
907 FileSize int `json:"file_size"`
908 FileDate int `json:"file_date"`
909}
910
911// EncryptedPassportElement - Contains information about documents or other Telegram Passport elements shared with the bot by the user.
912type EncryptedPassportElement struct {
913 Type string `json:"type"`
914 Data string `json:"data"`
915 PhoneNumber string `json:"phone_number"`
916 Email string `json:"email"`
917 Files []*PassportFile `json:"files"`
918 FrontSide *PassportFile `json:"front_side"`
919 ReverseSide *PassportFile `json:"reverse_side"`
920 Selfie *PassportFile `json:"selfie"`
921 Translation []*PassportFile `json:"translation"`
922 Hash string `json:"hash"`
923}
924
925// EncryptedCredentials - Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
926type EncryptedCredentials struct {
927 Data string `json:"data"`
928 Hash string `json:"hash"`
929 Secret string `json:"secret"`
930}
931
932// PassportElementErrorDataField - Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
933type PassportElementErrorDataField struct {
934 Source string `json:"source"`
935 Type string `json:"type"`
936 FieldName string `json:"field_name"`
937 DataHash string `json:"data_hash"`
938 Message string `json:"message"`
939}
940
941// PassportElementErrorFrontSide - Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
942type PassportElementErrorFrontSide struct {
943 Source string `json:"source"`
944 Type string `json:"type"`
945 FileHash string `json:"file_hash"`
946 Message string `json:"message"`
947}
948
949// PassportElementErrorReverseSide - Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
950type PassportElementErrorReverseSide struct {
951 Source string `json:"source"`
952 Type string `json:"type"`
953 FileHash string `json:"file_hash"`
954 Message string `json:"message"`
955}
956
957// PassportElementErrorSelfie - Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
958type PassportElementErrorSelfie struct {
959 Source string `json:"source"`
960 Type string `json:"type"`
961 FileHash string `json:"file_hash"`
962 Message string `json:"message"`
963}
964
965// PassportElementErrorFile - Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
966type PassportElementErrorFile struct {
967 Source string `json:"source"`
968 Type string `json:"type"`
969 FileHash string `json:"file_hash"`
970 Message string `json:"message"`
971}
972
973// PassportElementErrorFiles - Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
974type PassportElementErrorFiles struct {
975 Source string `json:"source"`
976 Type string `json:"type"`
977 FileHashes []string `json:"file_hashes"`
978 Message string `json:"message"`
979}
980
981// PassportElementErrorTranslationFile - Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
982type PassportElementErrorTranslationFile struct {
983 Source string `json:"source"`
984 Type string `json:"type"`
985 FileHash string `json:"file_hash"`
986 Message string `json:"message"`
987}
988
989// PassportElementErrorTranslationFiles - Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
990type PassportElementErrorTranslationFiles struct {
991 Source string `json:"source"`
992 Type string `json:"type"`
993 FileHashes []string `json:"file_hashes"`
994 Message string `json:"message"`
995}
996
997// PassportElementErrorUnspecified - Represents an issue in an unspecified place. The error is considered resolved when new data is added.
998type PassportElementErrorUnspecified struct {
999 Source string `json:"source"`
1000 Type string `json:"type"`
1001 ElementHash string `json:"element_hash"`
1002 Message string `json:"message"`
1003}
1004
1005// Game - This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
1006type Game struct {
1007 Title string `json:"title"`
1008 Description string `json:"description"`
1009 Photo []*PhotoSize `json:"photo"`
1010 Text string `json:"text"`
1011 TextEntities []*MessageEntity `json:"text_entities"`
1012 Animation *Animation `json:"animation"`
1013}
1014
1015// CallbackGame - A placeholder, currently holds no information. Use BotFather to set up your game.
1016type CallbackGame struct {
1017}
1018
1019// GameHighScore - This object represents one row of the high scores table for a game.
1020type GameHighScore struct {
1021 Position int `json:"position"`
1022 User *User `json:"user"`
1023 Score int `json:"score"`
1024}
1025
1026// GetUpdatesMethod represents Telegram Bot API method getUpdates
1027// Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
1028type GetUpdatesMethod struct {
1029 Offset int `json:"offset"`
1030 Limit int `json:"limit"`
1031 Timeout int `json:"timeout"`
1032 AllowedUpdates []string `json:"allowed_updates"`
1033}
1034
1035// GetUpdates creates new Telegram Bot API method getUpdates
1036// Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
1037func GetUpdates() *GetUpdatesMethod {
1038 return &GetUpdatesMethod{}
1039}
1040
1041// SetOffset - Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.
1042func (m *GetUpdatesMethod) SetOffset(value int) *GetUpdatesMethod {
1043 m.Offset = value
1044 return m
1045}
1046
1047// SetLimit - Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.
1048func (m *GetUpdatesMethod) SetLimit(value int) *GetUpdatesMethod {
1049 m.Limit = value
1050 return m
1051}
1052
1053// SetTimeout - Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
1054func (m *GetUpdatesMethod) SetTimeout(value int) *GetUpdatesMethod {
1055 m.Timeout = value
1056 return m
1057}
1058
1059// SetAllowedUpdates - A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.
1060func (m *GetUpdatesMethod) SetAllowedUpdates(value []string) *GetUpdatesMethod {
1061 m.AllowedUpdates = value
1062 return m
1063}
1064
1065// Send is used to send request using Telegram Bot Client
1066func (m *GetUpdatesMethod) Send(client *Client) (res []*Update, err error) {
1067 return res, client.request("getUpdates", m, &res)
1068}
1069
1070// SetWebhookMethod represents Telegram Bot API method setWebhook
1071// Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
1072type SetWebhookMethod struct {
1073 URL string `json:"url" required:"true"`
1074 Certificate InputFile `json:"certificate"`
1075 MaxConnections int `json:"max_connections"`
1076 AllowedUpdates []string `json:"allowed_updates"`
1077}
1078
1079// SetWebhook creates new Telegram Bot API method setWebhook
1080// Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
1081func SetWebhook(uRL string) *SetWebhookMethod {
1082 return &SetWebhookMethod{
1083 URL: uRL,
1084 }
1085}
1086
1087// SetURL - HTTPS url to send updates to. Use an empty string to remove webhook integration
1088func (m *SetWebhookMethod) SetURL(value string) *SetWebhookMethod {
1089 m.URL = value
1090 return m
1091}
1092
1093// SetCertificate - Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
1094func (m *SetWebhookMethod) SetCertificate(value InputFile) *SetWebhookMethod {
1095 m.Certificate = value
1096 return m
1097}
1098
1099// SetMaxConnections - Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.
1100func (m *SetWebhookMethod) SetMaxConnections(value int) *SetWebhookMethod {
1101 m.MaxConnections = value
1102 return m
1103}
1104
1105// SetAllowedUpdates - A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.
1106func (m *SetWebhookMethod) SetAllowedUpdates(value []string) *SetWebhookMethod {
1107 m.AllowedUpdates = value
1108 return m
1109}
1110
1111// Send is used to send request using Telegram Bot Client
1112func (m *SetWebhookMethod) Send(client *Client) (res *Update, err error) {
1113 return res, client.request("setWebhook", m, &res)
1114}
1115
1116// DeleteWebhookMethod represents Telegram Bot API method deleteWebhook
1117// Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
1118type DeleteWebhookMethod struct {
1119}
1120
1121// DeleteWebhook creates new Telegram Bot API method deleteWebhook
1122// Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
1123func DeleteWebhook() *DeleteWebhookMethod {
1124 return &DeleteWebhookMethod{}
1125}
1126
1127// Send is used to send request using Telegram Bot Client
1128func (m *DeleteWebhookMethod) Send(client *Client) (res *bool, err error) {
1129 return res, client.request("deleteWebhook", m, &res)
1130}
1131
1132// GetWebhookInfoMethod represents Telegram Bot API method getWebhookInfo
1133// Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
1134type GetWebhookInfoMethod struct {
1135}
1136
1137// GetWebhookInfo creates new Telegram Bot API method getWebhookInfo
1138// Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
1139func GetWebhookInfo() *GetWebhookInfoMethod {
1140 return &GetWebhookInfoMethod{}
1141}
1142
1143// Send is used to send request using Telegram Bot Client
1144func (m *GetWebhookInfoMethod) Send(client *Client) (res *WebhookInfo, err error) {
1145 return res, client.request("getWebhookInfo", m, &res)
1146}
1147
1148// GetMeMethod represents Telegram Bot API method getMe
1149// A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
1150type GetMeMethod struct {
1151}
1152
1153// GetMe creates new Telegram Bot API method getMe
1154// A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
1155func GetMe() *GetMeMethod {
1156 return &GetMeMethod{}
1157}
1158
1159// Send is used to send request using Telegram Bot Client
1160func (m *GetMeMethod) Send(client *Client) (res *User, err error) {
1161 return res, client.request("getMe", m, &res)
1162}
1163
1164// SendMessageMethod represents Telegram Bot API method sendMessage
1165// Use this method to send text messages. On success, the sent Message is returned.
1166type SendMessageMethod struct {
1167 ChatID ChatID `json:"chat_id" required:"true"`
1168 Text string `json:"text" required:"true"`
1169 ParseMode string `json:"parse_mode"`
1170 DisableWebPagePreview bool `json:"disable_web_page_preview"`
1171 DisableNotification bool `json:"disable_notification"`
1172 ReplyToMessageID int `json:"reply_to_message_id"`
1173 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1174}
1175
1176// SendMessage creates new Telegram Bot API method sendMessage
1177// Use this method to send text messages. On success, the sent Message is returned.
1178func SendMessage(chatID ChatID, text string) *SendMessageMethod {
1179 return &SendMessageMethod{
1180 ChatID: chatID,
1181 Text: text,
1182 }
1183}
1184
1185// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1186func (m *SendMessageMethod) SetChatID(value ChatID) *SendMessageMethod {
1187 m.ChatID = value
1188 return m
1189}
1190
1191// SetText - Text of the message to be sent, 1-4096 characters after entities parsing
1192func (m *SendMessageMethod) SetText(value string) *SendMessageMethod {
1193 m.Text = value
1194 return m
1195}
1196
1197// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
1198func (m *SendMessageMethod) SetParseMode(value string) *SendMessageMethod {
1199 m.ParseMode = value
1200 return m
1201}
1202
1203// SetDisableWebPagePreview - Disables link previews for links in this message
1204func (m *SendMessageMethod) SetDisableWebPagePreview(value bool) *SendMessageMethod {
1205 m.DisableWebPagePreview = value
1206 return m
1207}
1208
1209// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1210func (m *SendMessageMethod) SetDisableNotification(value bool) *SendMessageMethod {
1211 m.DisableNotification = value
1212 return m
1213}
1214
1215// SetReplyToMessageID - If the message is a reply, ID of the original message
1216func (m *SendMessageMethod) SetReplyToMessageID(value int) *SendMessageMethod {
1217 m.ReplyToMessageID = value
1218 return m
1219}
1220
1221// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1222func (m *SendMessageMethod) SetReplyMarkup(value ReplyMarkup) *SendMessageMethod {
1223 m.ReplyMarkup = value
1224 return m
1225}
1226
1227// Send is used to send request using Telegram Bot Client
1228func (m *SendMessageMethod) Send(client *Client) (res *Message, err error) {
1229 return res, client.request("sendMessage", m, &res)
1230}
1231
1232// ForwardMessageMethod represents Telegram Bot API method forwardMessage
1233// Use this method to forward messages of any kind. On success, the sent Message is returned.
1234type ForwardMessageMethod struct {
1235 ChatID ChatID `json:"chat_id" required:"true"`
1236 FromChatID ChatID `json:"from_chat_id" required:"true"`
1237 DisableNotification bool `json:"disable_notification"`
1238 MessageID int `json:"message_id" required:"true"`
1239}
1240
1241// ForwardMessage creates new Telegram Bot API method forwardMessage
1242// Use this method to forward messages of any kind. On success, the sent Message is returned.
1243func ForwardMessage(chatID ChatID, fromChatID ChatID, messageID int) *ForwardMessageMethod {
1244 return &ForwardMessageMethod{
1245 ChatID: chatID,
1246 FromChatID: fromChatID,
1247 MessageID: messageID,
1248 }
1249}
1250
1251// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1252func (m *ForwardMessageMethod) SetChatID(value ChatID) *ForwardMessageMethod {
1253 m.ChatID = value
1254 return m
1255}
1256
1257// SetFromChatID - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
1258func (m *ForwardMessageMethod) SetFromChatID(value ChatID) *ForwardMessageMethod {
1259 m.FromChatID = value
1260 return m
1261}
1262
1263// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1264func (m *ForwardMessageMethod) SetDisableNotification(value bool) *ForwardMessageMethod {
1265 m.DisableNotification = value
1266 return m
1267}
1268
1269// SetMessageID - Message identifier in the chat specified in from_chat_id
1270func (m *ForwardMessageMethod) SetMessageID(value int) *ForwardMessageMethod {
1271 m.MessageID = value
1272 return m
1273}
1274
1275// Send is used to send request using Telegram Bot Client
1276func (m *ForwardMessageMethod) Send(client *Client) (res *Message, err error) {
1277 return res, client.request("forwardMessage", m, &res)
1278}
1279
1280// SendPhotoMethod represents Telegram Bot API method sendPhoto
1281// Use this method to send photos. On success, the sent Message is returned.
1282type SendPhotoMethod struct {
1283 ChatID ChatID `json:"chat_id" required:"true"`
1284 Photo InputFile `json:"photo" required:"true"`
1285 Caption string `json:"caption"`
1286 ParseMode string `json:"parse_mode"`
1287 DisableNotification bool `json:"disable_notification"`
1288 ReplyToMessageID int `json:"reply_to_message_id"`
1289 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1290}
1291
1292// SendPhoto creates new Telegram Bot API method sendPhoto
1293// Use this method to send photos. On success, the sent Message is returned.
1294func SendPhoto(chatID ChatID, photo InputFile) *SendPhotoMethod {
1295 return &SendPhotoMethod{
1296 ChatID: chatID,
1297 Photo: photo,
1298 }
1299}
1300
1301// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1302func (m *SendPhotoMethod) SetChatID(value ChatID) *SendPhotoMethod {
1303 m.ChatID = value
1304 return m
1305}
1306
1307// SetPhoto - Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. More info on Sending Files »
1308func (m *SendPhotoMethod) SetPhoto(value InputFile) *SendPhotoMethod {
1309 m.Photo = value
1310 return m
1311}
1312
1313// SetCaption - Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
1314func (m *SendPhotoMethod) SetCaption(value string) *SendPhotoMethod {
1315 m.Caption = value
1316 return m
1317}
1318
1319// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1320func (m *SendPhotoMethod) SetParseMode(value string) *SendPhotoMethod {
1321 m.ParseMode = value
1322 return m
1323}
1324
1325// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1326func (m *SendPhotoMethod) SetDisableNotification(value bool) *SendPhotoMethod {
1327 m.DisableNotification = value
1328 return m
1329}
1330
1331// SetReplyToMessageID - If the message is a reply, ID of the original message
1332func (m *SendPhotoMethod) SetReplyToMessageID(value int) *SendPhotoMethod {
1333 m.ReplyToMessageID = value
1334 return m
1335}
1336
1337// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1338func (m *SendPhotoMethod) SetReplyMarkup(value ReplyMarkup) *SendPhotoMethod {
1339 m.ReplyMarkup = value
1340 return m
1341}
1342
1343// Send is used to send request using Telegram Bot Client
1344func (m *SendPhotoMethod) Send(client *Client) (res *Message, err error) {
1345 return res, client.request("sendPhoto", m, &res)
1346}
1347
1348// SendAudioMethod represents Telegram Bot API method sendAudio
1349// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
1350type SendAudioMethod struct {
1351 ChatID ChatID `json:"chat_id" required:"true"`
1352 Audio InputFile `json:"audio" required:"true"`
1353 Caption string `json:"caption"`
1354 ParseMode string `json:"parse_mode"`
1355 Duration int `json:"duration"`
1356 Performer string `json:"performer"`
1357 Title string `json:"title"`
1358 Thumb InputFile `json:"thumb"`
1359 DisableNotification bool `json:"disable_notification"`
1360 ReplyToMessageID int `json:"reply_to_message_id"`
1361 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1362}
1363
1364// SendAudio creates new Telegram Bot API method sendAudio
1365// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
1366func SendAudio(chatID ChatID, audio InputFile) *SendAudioMethod {
1367 return &SendAudioMethod{
1368 ChatID: chatID,
1369 Audio: audio,
1370 }
1371}
1372
1373// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1374func (m *SendAudioMethod) SetChatID(value ChatID) *SendAudioMethod {
1375 m.ChatID = value
1376 return m
1377}
1378
1379// SetAudio - Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
1380func (m *SendAudioMethod) SetAudio(value InputFile) *SendAudioMethod {
1381 m.Audio = value
1382 return m
1383}
1384
1385// SetCaption - Audio caption, 0-1024 characters after entities parsing
1386func (m *SendAudioMethod) SetCaption(value string) *SendAudioMethod {
1387 m.Caption = value
1388 return m
1389}
1390
1391// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1392func (m *SendAudioMethod) SetParseMode(value string) *SendAudioMethod {
1393 m.ParseMode = value
1394 return m
1395}
1396
1397// SetDuration - Duration of the audio in seconds
1398func (m *SendAudioMethod) SetDuration(value int) *SendAudioMethod {
1399 m.Duration = value
1400 return m
1401}
1402
1403// SetPerformer - Performer
1404func (m *SendAudioMethod) SetPerformer(value string) *SendAudioMethod {
1405 m.Performer = value
1406 return m
1407}
1408
1409// SetTitle - Track name
1410func (m *SendAudioMethod) SetTitle(value string) *SendAudioMethod {
1411 m.Title = value
1412 return m
1413}
1414
1415// SetThumb - Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »
1416func (m *SendAudioMethod) SetThumb(value InputFile) *SendAudioMethod {
1417 m.Thumb = value
1418 return m
1419}
1420
1421// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1422func (m *SendAudioMethod) SetDisableNotification(value bool) *SendAudioMethod {
1423 m.DisableNotification = value
1424 return m
1425}
1426
1427// SetReplyToMessageID - If the message is a reply, ID of the original message
1428func (m *SendAudioMethod) SetReplyToMessageID(value int) *SendAudioMethod {
1429 m.ReplyToMessageID = value
1430 return m
1431}
1432
1433// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1434func (m *SendAudioMethod) SetReplyMarkup(value ReplyMarkup) *SendAudioMethod {
1435 m.ReplyMarkup = value
1436 return m
1437}
1438
1439// Send is used to send request using Telegram Bot Client
1440func (m *SendAudioMethod) Send(client *Client) (res *Message, err error) {
1441 return res, client.request("sendAudio", m, &res)
1442}
1443
1444// SendDocumentMethod represents Telegram Bot API method sendDocument
1445// Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
1446type SendDocumentMethod struct {
1447 ChatID ChatID `json:"chat_id" required:"true"`
1448 Document InputFile `json:"document" required:"true"`
1449 Thumb InputFile `json:"thumb"`
1450 Caption string `json:"caption"`
1451 ParseMode string `json:"parse_mode"`
1452 DisableNotification bool `json:"disable_notification"`
1453 ReplyToMessageID int `json:"reply_to_message_id"`
1454 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1455}
1456
1457// SendDocument creates new Telegram Bot API method sendDocument
1458// Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
1459func SendDocument(chatID ChatID, document InputFile) *SendDocumentMethod {
1460 return &SendDocumentMethod{
1461 ChatID: chatID,
1462 Document: document,
1463 }
1464}
1465
1466// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1467func (m *SendDocumentMethod) SetChatID(value ChatID) *SendDocumentMethod {
1468 m.ChatID = value
1469 return m
1470}
1471
1472// SetDocument - File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
1473func (m *SendDocumentMethod) SetDocument(value InputFile) *SendDocumentMethod {
1474 m.Document = value
1475 return m
1476}
1477
1478// SetThumb - Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »
1479func (m *SendDocumentMethod) SetThumb(value InputFile) *SendDocumentMethod {
1480 m.Thumb = value
1481 return m
1482}
1483
1484// SetCaption - Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
1485func (m *SendDocumentMethod) SetCaption(value string) *SendDocumentMethod {
1486 m.Caption = value
1487 return m
1488}
1489
1490// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1491func (m *SendDocumentMethod) SetParseMode(value string) *SendDocumentMethod {
1492 m.ParseMode = value
1493 return m
1494}
1495
1496// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1497func (m *SendDocumentMethod) SetDisableNotification(value bool) *SendDocumentMethod {
1498 m.DisableNotification = value
1499 return m
1500}
1501
1502// SetReplyToMessageID - If the message is a reply, ID of the original message
1503func (m *SendDocumentMethod) SetReplyToMessageID(value int) *SendDocumentMethod {
1504 m.ReplyToMessageID = value
1505 return m
1506}
1507
1508// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1509func (m *SendDocumentMethod) SetReplyMarkup(value ReplyMarkup) *SendDocumentMethod {
1510 m.ReplyMarkup = value
1511 return m
1512}
1513
1514// Send is used to send request using Telegram Bot Client
1515func (m *SendDocumentMethod) Send(client *Client) (res *Message, err error) {
1516 return res, client.request("sendDocument", m, &res)
1517}
1518
1519// SendVideoMethod represents Telegram Bot API method sendVideo
1520// Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
1521type SendVideoMethod struct {
1522 ChatID ChatID `json:"chat_id" required:"true"`
1523 Video InputFile `json:"video" required:"true"`
1524 Duration int `json:"duration"`
1525 Width int `json:"width"`
1526 Height int `json:"height"`
1527 Thumb InputFile `json:"thumb"`
1528 Caption string `json:"caption"`
1529 ParseMode string `json:"parse_mode"`
1530 SupportsStreaming bool `json:"supports_streaming"`
1531 DisableNotification bool `json:"disable_notification"`
1532 ReplyToMessageID int `json:"reply_to_message_id"`
1533 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1534}
1535
1536// SendVideo creates new Telegram Bot API method sendVideo
1537// Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
1538func SendVideo(chatID ChatID, video InputFile) *SendVideoMethod {
1539 return &SendVideoMethod{
1540 ChatID: chatID,
1541 Video: video,
1542 }
1543}
1544
1545// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1546func (m *SendVideoMethod) SetChatID(value ChatID) *SendVideoMethod {
1547 m.ChatID = value
1548 return m
1549}
1550
1551// SetVideo - Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More info on Sending Files »
1552func (m *SendVideoMethod) SetVideo(value InputFile) *SendVideoMethod {
1553 m.Video = value
1554 return m
1555}
1556
1557// SetDuration - Duration of sent video in seconds
1558func (m *SendVideoMethod) SetDuration(value int) *SendVideoMethod {
1559 m.Duration = value
1560 return m
1561}
1562
1563// SetWidth - Video width
1564func (m *SendVideoMethod) SetWidth(value int) *SendVideoMethod {
1565 m.Width = value
1566 return m
1567}
1568
1569// SetHeight - Video height
1570func (m *SendVideoMethod) SetHeight(value int) *SendVideoMethod {
1571 m.Height = value
1572 return m
1573}
1574
1575// SetThumb - Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »
1576func (m *SendVideoMethod) SetThumb(value InputFile) *SendVideoMethod {
1577 m.Thumb = value
1578 return m
1579}
1580
1581// SetCaption - Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
1582func (m *SendVideoMethod) SetCaption(value string) *SendVideoMethod {
1583 m.Caption = value
1584 return m
1585}
1586
1587// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1588func (m *SendVideoMethod) SetParseMode(value string) *SendVideoMethod {
1589 m.ParseMode = value
1590 return m
1591}
1592
1593// SetSupportsStreaming - Pass True, if the uploaded video is suitable for streaming
1594func (m *SendVideoMethod) SetSupportsStreaming(value bool) *SendVideoMethod {
1595 m.SupportsStreaming = value
1596 return m
1597}
1598
1599// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1600func (m *SendVideoMethod) SetDisableNotification(value bool) *SendVideoMethod {
1601 m.DisableNotification = value
1602 return m
1603}
1604
1605// SetReplyToMessageID - If the message is a reply, ID of the original message
1606func (m *SendVideoMethod) SetReplyToMessageID(value int) *SendVideoMethod {
1607 m.ReplyToMessageID = value
1608 return m
1609}
1610
1611// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1612func (m *SendVideoMethod) SetReplyMarkup(value ReplyMarkup) *SendVideoMethod {
1613 m.ReplyMarkup = value
1614 return m
1615}
1616
1617// Send is used to send request using Telegram Bot Client
1618func (m *SendVideoMethod) Send(client *Client) (res *Message, err error) {
1619 return res, client.request("sendVideo", m, &res)
1620}
1621
1622// SendAnimationMethod represents Telegram Bot API method sendAnimation
1623// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
1624type SendAnimationMethod struct {
1625 ChatID ChatID `json:"chat_id" required:"true"`
1626 Animation InputFile `json:"animation" required:"true"`
1627 Duration int `json:"duration"`
1628 Width int `json:"width"`
1629 Height int `json:"height"`
1630 Thumb InputFile `json:"thumb"`
1631 Caption string `json:"caption"`
1632 ParseMode string `json:"parse_mode"`
1633 DisableNotification bool `json:"disable_notification"`
1634 ReplyToMessageID int `json:"reply_to_message_id"`
1635 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1636}
1637
1638// SendAnimation creates new Telegram Bot API method sendAnimation
1639// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
1640func SendAnimation(chatID ChatID, animation InputFile) *SendAnimationMethod {
1641 return &SendAnimationMethod{
1642 ChatID: chatID,
1643 Animation: animation,
1644 }
1645}
1646
1647// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1648func (m *SendAnimationMethod) SetChatID(value ChatID) *SendAnimationMethod {
1649 m.ChatID = value
1650 return m
1651}
1652
1653// SetAnimation - Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More info on Sending Files »
1654func (m *SendAnimationMethod) SetAnimation(value InputFile) *SendAnimationMethod {
1655 m.Animation = value
1656 return m
1657}
1658
1659// SetDuration - Duration of sent animation in seconds
1660func (m *SendAnimationMethod) SetDuration(value int) *SendAnimationMethod {
1661 m.Duration = value
1662 return m
1663}
1664
1665// SetWidth - Animation width
1666func (m *SendAnimationMethod) SetWidth(value int) *SendAnimationMethod {
1667 m.Width = value
1668 return m
1669}
1670
1671// SetHeight - Animation height
1672func (m *SendAnimationMethod) SetHeight(value int) *SendAnimationMethod {
1673 m.Height = value
1674 return m
1675}
1676
1677// SetThumb - Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »
1678func (m *SendAnimationMethod) SetThumb(value InputFile) *SendAnimationMethod {
1679 m.Thumb = value
1680 return m
1681}
1682
1683// SetCaption - Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
1684func (m *SendAnimationMethod) SetCaption(value string) *SendAnimationMethod {
1685 m.Caption = value
1686 return m
1687}
1688
1689// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1690func (m *SendAnimationMethod) SetParseMode(value string) *SendAnimationMethod {
1691 m.ParseMode = value
1692 return m
1693}
1694
1695// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1696func (m *SendAnimationMethod) SetDisableNotification(value bool) *SendAnimationMethod {
1697 m.DisableNotification = value
1698 return m
1699}
1700
1701// SetReplyToMessageID - If the message is a reply, ID of the original message
1702func (m *SendAnimationMethod) SetReplyToMessageID(value int) *SendAnimationMethod {
1703 m.ReplyToMessageID = value
1704 return m
1705}
1706
1707// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1708func (m *SendAnimationMethod) SetReplyMarkup(value ReplyMarkup) *SendAnimationMethod {
1709 m.ReplyMarkup = value
1710 return m
1711}
1712
1713// Send is used to send request using Telegram Bot Client
1714func (m *SendAnimationMethod) Send(client *Client) (res *Message, err error) {
1715 return res, client.request("sendAnimation", m, &res)
1716}
1717
1718// SendVoiceMethod represents Telegram Bot API method sendVoice
1719// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
1720type SendVoiceMethod struct {
1721 ChatID ChatID `json:"chat_id" required:"true"`
1722 Voice InputFile `json:"voice" required:"true"`
1723 Caption string `json:"caption"`
1724 ParseMode string `json:"parse_mode"`
1725 Duration int `json:"duration"`
1726 DisableNotification bool `json:"disable_notification"`
1727 ReplyToMessageID int `json:"reply_to_message_id"`
1728 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1729}
1730
1731// SendVoice creates new Telegram Bot API method sendVoice
1732// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
1733func SendVoice(chatID ChatID, voice InputFile) *SendVoiceMethod {
1734 return &SendVoiceMethod{
1735 ChatID: chatID,
1736 Voice: voice,
1737 }
1738}
1739
1740// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1741func (m *SendVoiceMethod) SetChatID(value ChatID) *SendVoiceMethod {
1742 m.ChatID = value
1743 return m
1744}
1745
1746// SetVoice - Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
1747func (m *SendVoiceMethod) SetVoice(value InputFile) *SendVoiceMethod {
1748 m.Voice = value
1749 return m
1750}
1751
1752// SetCaption - Voice message caption, 0-1024 characters after entities parsing
1753func (m *SendVoiceMethod) SetCaption(value string) *SendVoiceMethod {
1754 m.Caption = value
1755 return m
1756}
1757
1758// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1759func (m *SendVoiceMethod) SetParseMode(value string) *SendVoiceMethod {
1760 m.ParseMode = value
1761 return m
1762}
1763
1764// SetDuration - Duration of the voice message in seconds
1765func (m *SendVoiceMethod) SetDuration(value int) *SendVoiceMethod {
1766 m.Duration = value
1767 return m
1768}
1769
1770// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1771func (m *SendVoiceMethod) SetDisableNotification(value bool) *SendVoiceMethod {
1772 m.DisableNotification = value
1773 return m
1774}
1775
1776// SetReplyToMessageID - If the message is a reply, ID of the original message
1777func (m *SendVoiceMethod) SetReplyToMessageID(value int) *SendVoiceMethod {
1778 m.ReplyToMessageID = value
1779 return m
1780}
1781
1782// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1783func (m *SendVoiceMethod) SetReplyMarkup(value ReplyMarkup) *SendVoiceMethod {
1784 m.ReplyMarkup = value
1785 return m
1786}
1787
1788// Send is used to send request using Telegram Bot Client
1789func (m *SendVoiceMethod) Send(client *Client) (res *Message, err error) {
1790 return res, client.request("sendVoice", m, &res)
1791}
1792
1793// SendVideoNoteMethod represents Telegram Bot API method sendVideoNote
1794// As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
1795type SendVideoNoteMethod struct {
1796 ChatID ChatID `json:"chat_id" required:"true"`
1797 VideoNote InputFile `json:"video_note" required:"true"`
1798 Duration int `json:"duration"`
1799 Length int `json:"length"`
1800 Thumb InputFile `json:"thumb"`
1801 DisableNotification bool `json:"disable_notification"`
1802 ReplyToMessageID int `json:"reply_to_message_id"`
1803 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1804}
1805
1806// SendVideoNote creates new Telegram Bot API method sendVideoNote
1807// As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
1808func SendVideoNote(chatID ChatID, videoNote InputFile) *SendVideoNoteMethod {
1809 return &SendVideoNoteMethod{
1810 ChatID: chatID,
1811 VideoNote: videoNote,
1812 }
1813}
1814
1815// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1816func (m *SendVideoNoteMethod) SetChatID(value ChatID) *SendVideoNoteMethod {
1817 m.ChatID = value
1818 return m
1819}
1820
1821// SetVideoNote - Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported
1822func (m *SendVideoNoteMethod) SetVideoNote(value InputFile) *SendVideoNoteMethod {
1823 m.VideoNote = value
1824 return m
1825}
1826
1827// SetDuration - Duration of sent video in seconds
1828func (m *SendVideoNoteMethod) SetDuration(value int) *SendVideoNoteMethod {
1829 m.Duration = value
1830 return m
1831}
1832
1833// SetLength - Video width and height, i.e. diameter of the video message
1834func (m *SendVideoNoteMethod) SetLength(value int) *SendVideoNoteMethod {
1835 m.Length = value
1836 return m
1837}
1838
1839// SetThumb - Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »
1840func (m *SendVideoNoteMethod) SetThumb(value InputFile) *SendVideoNoteMethod {
1841 m.Thumb = value
1842 return m
1843}
1844
1845// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1846func (m *SendVideoNoteMethod) SetDisableNotification(value bool) *SendVideoNoteMethod {
1847 m.DisableNotification = value
1848 return m
1849}
1850
1851// SetReplyToMessageID - If the message is a reply, ID of the original message
1852func (m *SendVideoNoteMethod) SetReplyToMessageID(value int) *SendVideoNoteMethod {
1853 m.ReplyToMessageID = value
1854 return m
1855}
1856
1857// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1858func (m *SendVideoNoteMethod) SetReplyMarkup(value ReplyMarkup) *SendVideoNoteMethod {
1859 m.ReplyMarkup = value
1860 return m
1861}
1862
1863// Send is used to send request using Telegram Bot Client
1864func (m *SendVideoNoteMethod) Send(client *Client) (res *Message, err error) {
1865 return res, client.request("sendVideoNote", m, &res)
1866}
1867
1868// SendMediaGroupMethod represents Telegram Bot API method sendMediaGroup
1869// Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
1870type SendMediaGroupMethod struct {
1871 ChatID ChatID `json:"chat_id" required:"true"`
1872 Media InputMedia `json:"media" required:"true"`
1873 DisableNotification bool `json:"disable_notification"`
1874 ReplyToMessageID int `json:"reply_to_message_id"`
1875}
1876
1877// SendMediaGroup creates new Telegram Bot API method sendMediaGroup
1878// Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
1879func SendMediaGroup(chatID ChatID, media InputMedia) *SendMediaGroupMethod {
1880 return &SendMediaGroupMethod{
1881 ChatID: chatID,
1882 Media: media,
1883 }
1884}
1885
1886// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1887func (m *SendMediaGroupMethod) SetChatID(value ChatID) *SendMediaGroupMethod {
1888 m.ChatID = value
1889 return m
1890}
1891
1892// SetMedia - A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
1893func (m *SendMediaGroupMethod) SetMedia(value InputMedia) *SendMediaGroupMethod {
1894 m.Media = value
1895 return m
1896}
1897
1898// SetDisableNotification - Sends the messages silently. Users will receive a notification with no sound.
1899func (m *SendMediaGroupMethod) SetDisableNotification(value bool) *SendMediaGroupMethod {
1900 m.DisableNotification = value
1901 return m
1902}
1903
1904// SetReplyToMessageID - If the messages are a reply, ID of the original message
1905func (m *SendMediaGroupMethod) SetReplyToMessageID(value int) *SendMediaGroupMethod {
1906 m.ReplyToMessageID = value
1907 return m
1908}
1909
1910// Send is used to send request using Telegram Bot Client
1911func (m *SendMediaGroupMethod) Send(client *Client) (res []*Message, err error) {
1912 return res, client.request("sendMediaGroup", m, &res)
1913}
1914
1915// SendLocationMethod represents Telegram Bot API method sendLocation
1916// Use this method to send point on the map. On success, the sent Message is returned.
1917type SendLocationMethod struct {
1918 ChatID ChatID `json:"chat_id" required:"true"`
1919 Latitude float64 `json:"latitude" required:"true"`
1920 Longitude float64 `json:"longitude" required:"true"`
1921 LivePeriod int `json:"live_period"`
1922 DisableNotification bool `json:"disable_notification"`
1923 ReplyToMessageID int `json:"reply_to_message_id"`
1924 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1925}
1926
1927// SendLocation creates new Telegram Bot API method sendLocation
1928// Use this method to send point on the map. On success, the sent Message is returned.
1929func SendLocation(chatID ChatID, latitude float64, longitude float64) *SendLocationMethod {
1930 return &SendLocationMethod{
1931 ChatID: chatID,
1932 Latitude: latitude,
1933 Longitude: longitude,
1934 }
1935}
1936
1937// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1938func (m *SendLocationMethod) SetChatID(value ChatID) *SendLocationMethod {
1939 m.ChatID = value
1940 return m
1941}
1942
1943// SetLatitude - Latitude of the location
1944func (m *SendLocationMethod) SetLatitude(value float64) *SendLocationMethod {
1945 m.Latitude = value
1946 return m
1947}
1948
1949// SetLongitude - Longitude of the location
1950func (m *SendLocationMethod) SetLongitude(value float64) *SendLocationMethod {
1951 m.Longitude = value
1952 return m
1953}
1954
1955// SetLivePeriod - Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.
1956func (m *SendLocationMethod) SetLivePeriod(value int) *SendLocationMethod {
1957 m.LivePeriod = value
1958 return m
1959}
1960
1961// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1962func (m *SendLocationMethod) SetDisableNotification(value bool) *SendLocationMethod {
1963 m.DisableNotification = value
1964 return m
1965}
1966
1967// SetReplyToMessageID - If the message is a reply, ID of the original message
1968func (m *SendLocationMethod) SetReplyToMessageID(value int) *SendLocationMethod {
1969 m.ReplyToMessageID = value
1970 return m
1971}
1972
1973// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1974func (m *SendLocationMethod) SetReplyMarkup(value ReplyMarkup) *SendLocationMethod {
1975 m.ReplyMarkup = value
1976 return m
1977}
1978
1979// Send is used to send request using Telegram Bot Client
1980func (m *SendLocationMethod) Send(client *Client) (res *Message, err error) {
1981 return res, client.request("sendLocation", m, &res)
1982}
1983
1984// EditMessageLiveLocationMethod represents Telegram Bot API method editMessageLiveLocation
1985// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
1986type EditMessageLiveLocationMethod struct {
1987 ChatID ChatID `json:"chat_id"`
1988 MessageID int `json:"message_id"`
1989 InlineMessageID string `json:"inline_message_id"`
1990 Latitude float64 `json:"latitude" required:"true"`
1991 Longitude float64 `json:"longitude" required:"true"`
1992 ReplyMarkup ReplyMarkup `json:"reply_markup"`
1993}
1994
1995// EditMessageLiveLocation creates new Telegram Bot API method editMessageLiveLocation
1996// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
1997func EditMessageLiveLocation(latitude float64, longitude float64) *EditMessageLiveLocationMethod {
1998 return &EditMessageLiveLocationMethod{
1999 Latitude: latitude,
2000 Longitude: longitude,
2001 }
2002}
2003
2004// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2005func (m *EditMessageLiveLocationMethod) SetChatID(value ChatID) *EditMessageLiveLocationMethod {
2006 m.ChatID = value
2007 return m
2008}
2009
2010// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
2011func (m *EditMessageLiveLocationMethod) SetMessageID(value int) *EditMessageLiveLocationMethod {
2012 m.MessageID = value
2013 return m
2014}
2015
2016// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
2017func (m *EditMessageLiveLocationMethod) SetInlineMessageID(value string) *EditMessageLiveLocationMethod {
2018 m.InlineMessageID = value
2019 return m
2020}
2021
2022// SetLatitude - Latitude of new location
2023func (m *EditMessageLiveLocationMethod) SetLatitude(value float64) *EditMessageLiveLocationMethod {
2024 m.Latitude = value
2025 return m
2026}
2027
2028// SetLongitude - Longitude of new location
2029func (m *EditMessageLiveLocationMethod) SetLongitude(value float64) *EditMessageLiveLocationMethod {
2030 m.Longitude = value
2031 return m
2032}
2033
2034// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
2035func (m *EditMessageLiveLocationMethod) SetReplyMarkup(value ReplyMarkup) *EditMessageLiveLocationMethod {
2036 m.ReplyMarkup = value
2037 return m
2038}
2039
2040// Send is used to send request using Telegram Bot Client
2041func (m *EditMessageLiveLocationMethod) Send(client *Client) (res *Message, err error) {
2042 return res, client.request("editMessageLiveLocation", m, &res)
2043}
2044
2045// StopMessageLiveLocationMethod represents Telegram Bot API method stopMessageLiveLocation
2046// Use this method to stop updating a live location message before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
2047type StopMessageLiveLocationMethod struct {
2048 ChatID ChatID `json:"chat_id"`
2049 MessageID int `json:"message_id"`
2050 InlineMessageID string `json:"inline_message_id"`
2051 ReplyMarkup ReplyMarkup `json:"reply_markup"`
2052}
2053
2054// StopMessageLiveLocation creates new Telegram Bot API method stopMessageLiveLocation
2055// Use this method to stop updating a live location message before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
2056func StopMessageLiveLocation() *StopMessageLiveLocationMethod {
2057 return &StopMessageLiveLocationMethod{}
2058}
2059
2060// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2061func (m *StopMessageLiveLocationMethod) SetChatID(value ChatID) *StopMessageLiveLocationMethod {
2062 m.ChatID = value
2063 return m
2064}
2065
2066// SetMessageID - Required if inline_message_id is not specified. Identifier of the message with live location to stop
2067func (m *StopMessageLiveLocationMethod) SetMessageID(value int) *StopMessageLiveLocationMethod {
2068 m.MessageID = value
2069 return m
2070}
2071
2072// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
2073func (m *StopMessageLiveLocationMethod) SetInlineMessageID(value string) *StopMessageLiveLocationMethod {
2074 m.InlineMessageID = value
2075 return m
2076}
2077
2078// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
2079func (m *StopMessageLiveLocationMethod) SetReplyMarkup(value ReplyMarkup) *StopMessageLiveLocationMethod {
2080 m.ReplyMarkup = value
2081 return m
2082}
2083
2084// Send is used to send request using Telegram Bot Client
2085func (m *StopMessageLiveLocationMethod) Send(client *Client) (res *Message, err error) {
2086 return res, client.request("stopMessageLiveLocation", m, &res)
2087}
2088
2089// SendVenueMethod represents Telegram Bot API method sendVenue
2090// Use this method to send information about a venue. On success, the sent Message is returned.
2091type SendVenueMethod struct {
2092 ChatID ChatID `json:"chat_id" required:"true"`
2093 Latitude float64 `json:"latitude" required:"true"`
2094 Longitude float64 `json:"longitude" required:"true"`
2095 Title string `json:"title" required:"true"`
2096 Address string `json:"address" required:"true"`
2097 FoursquareID string `json:"foursquare_id"`
2098 FoursquareType string `json:"foursquare_type"`
2099 DisableNotification bool `json:"disable_notification"`
2100 ReplyToMessageID int `json:"reply_to_message_id"`
2101 ReplyMarkup ReplyMarkup `json:"reply_markup"`
2102}
2103
2104// SendVenue creates new Telegram Bot API method sendVenue
2105// Use this method to send information about a venue. On success, the sent Message is returned.
2106func SendVenue(chatID ChatID, latitude float64, longitude float64, title string, address string) *SendVenueMethod {
2107 return &SendVenueMethod{
2108 ChatID: chatID,
2109 Latitude: latitude,
2110 Longitude: longitude,
2111 Title: title,
2112 Address: address,
2113 }
2114}
2115
2116// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2117func (m *SendVenueMethod) SetChatID(value ChatID) *SendVenueMethod {
2118 m.ChatID = value
2119 return m
2120}
2121
2122// SetLatitude - Latitude of the venue
2123func (m *SendVenueMethod) SetLatitude(value float64) *SendVenueMethod {
2124 m.Latitude = value
2125 return m
2126}
2127
2128// SetLongitude - Longitude of the venue
2129func (m *SendVenueMethod) SetLongitude(value float64) *SendVenueMethod {
2130 m.Longitude = value
2131 return m
2132}
2133
2134// SetTitle - Name of the venue
2135func (m *SendVenueMethod) SetTitle(value string) *SendVenueMethod {
2136 m.Title = value
2137 return m
2138}
2139
2140// SetAddress - Address of the venue
2141func (m *SendVenueMethod) SetAddress(value string) *SendVenueMethod {
2142 m.Address = value
2143 return m
2144}
2145
2146// SetFoursquareID - Foursquare identifier of the venue
2147func (m *SendVenueMethod) SetFoursquareID(value string) *SendVenueMethod {
2148 m.FoursquareID = value
2149 return m
2150}
2151
2152// SetFoursquareType - Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2153func (m *SendVenueMethod) SetFoursquareType(value string) *SendVenueMethod {
2154 m.FoursquareType = value
2155 return m
2156}
2157
2158// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2159func (m *SendVenueMethod) SetDisableNotification(value bool) *SendVenueMethod {
2160 m.DisableNotification = value
2161 return m
2162}
2163
2164// SetReplyToMessageID - If the message is a reply, ID of the original message
2165func (m *SendVenueMethod) SetReplyToMessageID(value int) *SendVenueMethod {
2166 m.ReplyToMessageID = value
2167 return m
2168}
2169
2170// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
2171func (m *SendVenueMethod) SetReplyMarkup(value ReplyMarkup) *SendVenueMethod {
2172 m.ReplyMarkup = value
2173 return m
2174}
2175
2176// Send is used to send request using Telegram Bot Client
2177func (m *SendVenueMethod) Send(client *Client) (res *Message, err error) {
2178 return res, client.request("sendVenue", m, &res)
2179}
2180
2181// SendContactMethod represents Telegram Bot API method sendContact
2182// Use this method to send phone contacts. On success, the sent Message is returned.
2183type SendContactMethod struct {
2184 ChatID ChatID `json:"chat_id" required:"true"`
2185 PhoneNumber string `json:"phone_number" required:"true"`
2186 FirstName string `json:"first_name" required:"true"`
2187 LastName string `json:"last_name"`
2188 Vcard string `json:"vcard"`
2189 DisableNotification bool `json:"disable_notification"`
2190 ReplyToMessageID int `json:"reply_to_message_id"`
2191 ReplyMarkup ReplyMarkup `json:"reply_markup"`
2192}
2193
2194// SendContact creates new Telegram Bot API method sendContact
2195// Use this method to send phone contacts. On success, the sent Message is returned.
2196func SendContact(chatID ChatID, phoneNumber string, firstName string) *SendContactMethod {
2197 return &SendContactMethod{
2198 ChatID: chatID,
2199 PhoneNumber: phoneNumber,
2200 FirstName: firstName,
2201 }
2202}
2203
2204// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2205func (m *SendContactMethod) SetChatID(value ChatID) *SendContactMethod {
2206 m.ChatID = value
2207 return m
2208}
2209
2210// SetPhoneNumber - Contact's phone number
2211func (m *SendContactMethod) SetPhoneNumber(value string) *SendContactMethod {
2212 m.PhoneNumber = value
2213 return m
2214}
2215
2216// SetFirstName - Contact's first name
2217func (m *SendContactMethod) SetFirstName(value string) *SendContactMethod {
2218 m.FirstName = value
2219 return m
2220}
2221
2222// SetLastName - Contact's last name
2223func (m *SendContactMethod) SetLastName(value string) *SendContactMethod {
2224 m.LastName = value
2225 return m
2226}
2227
2228// SetVcard - Additional data about the contact in the form of a vCard, 0-2048 bytes
2229func (m *SendContactMethod) SetVcard(value string) *SendContactMethod {
2230 m.Vcard = value
2231 return m
2232}
2233
2234// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2235func (m *SendContactMethod) SetDisableNotification(value bool) *SendContactMethod {
2236 m.DisableNotification = value
2237 return m
2238}
2239
2240// SetReplyToMessageID - If the message is a reply, ID of the original message
2241func (m *SendContactMethod) SetReplyToMessageID(value int) *SendContactMethod {
2242 m.ReplyToMessageID = value
2243 return m
2244}
2245
2246// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user.
2247func (m *SendContactMethod) SetReplyMarkup(value ReplyMarkup) *SendContactMethod {
2248 m.ReplyMarkup = value
2249 return m
2250}
2251
2252// Send is used to send request using Telegram Bot Client
2253func (m *SendContactMethod) Send(client *Client) (res *Message, err error) {
2254 return res, client.request("sendContact", m, &res)
2255}
2256
2257// SendPollMethod represents Telegram Bot API method sendPoll
2258// Use this method to send a native poll. On success, the sent Message is returned.
2259type SendPollMethod struct {
2260 ChatID ChatID `json:"chat_id" required:"true"`
2261 Question string `json:"question" required:"true"`
2262 Options []string `json:"options" required:"true"`
2263 IsAnonymous bool `json:"is_anonymous"`
2264 Type string `json:"type"`
2265 AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
2266 CorrectOptionID int `json:"correct_option_id"`
2267 IsClosed bool `json:"is_closed"`
2268 DisableNotification bool `json:"disable_notification"`
2269 ReplyToMessageID int `json:"reply_to_message_id"`
2270 ReplyMarkup ReplyMarkup `json:"reply_markup"`
2271}
2272
2273// SendPoll creates new Telegram Bot API method sendPoll
2274// Use this method to send a native poll. On success, the sent Message is returned.
2275func SendPoll(chatID ChatID, question string, options []string) *SendPollMethod {
2276 return &SendPollMethod{
2277 ChatID: chatID,
2278 Question: question,
2279 Options: options,
2280 }
2281}
2282
2283// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2284func (m *SendPollMethod) SetChatID(value ChatID) *SendPollMethod {
2285 m.ChatID = value
2286 return m
2287}
2288
2289// SetQuestion - Poll question, 1-255 characters
2290func (m *SendPollMethod) SetQuestion(value string) *SendPollMethod {
2291 m.Question = value
2292 return m
2293}
2294
2295// SetOptions - A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
2296func (m *SendPollMethod) SetOptions(value []string) *SendPollMethod {
2297 m.Options = value
2298 return m
2299}
2300
2301// SetIsAnonymous - True, if the poll needs to be anonymous, defaults to True
2302func (m *SendPollMethod) SetIsAnonymous(value bool) *SendPollMethod {
2303 m.IsAnonymous = value
2304 return m
2305}
2306
2307// SetType - Poll type, “quiz” or “regular”, defaults to “regular”
2308func (m *SendPollMethod) SetType(value string) *SendPollMethod {
2309 m.Type = value
2310 return m
2311}
2312
2313// SetAllowsMultipleAnswers - True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
2314func (m *SendPollMethod) SetAllowsMultipleAnswers(value bool) *SendPollMethod {
2315 m.AllowsMultipleAnswers = value
2316 return m
2317}
2318
2319// SetCorrectOptionID - 0-based identifier of the correct answer option, required for polls in quiz mode
2320func (m *SendPollMethod) SetCorrectOptionID(value int) *SendPollMethod {
2321 m.CorrectOptionID = value
2322 return m
2323}
2324
2325// SetIsClosed - Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
2326func (m *SendPollMethod) SetIsClosed(value bool) *SendPollMethod {
2327 m.IsClosed = value
2328 return m
2329}
2330
2331// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2332func (m *SendPollMethod) SetDisableNotification(value bool) *SendPollMethod {
2333 m.DisableNotification = value
2334 return m
2335}
2336
2337// SetReplyToMessageID - If the message is a reply, ID of the original message
2338func (m *SendPollMethod) SetReplyToMessageID(value int) *SendPollMethod {
2339 m.ReplyToMessageID = value
2340 return m
2341}
2342
2343// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
2344func (m *SendPollMethod) SetReplyMarkup(value ReplyMarkup) *SendPollMethod {
2345 m.ReplyMarkup = value
2346 return m
2347}
2348
2349// Send is used to send request using Telegram Bot Client
2350func (m *SendPollMethod) Send(client *Client) (res *Message, err error) {
2351 return res, client.request("sendPoll", m, &res)
2352}
2353
2354// SendChatActionMethod represents Telegram Bot API method sendChatAction
2355// Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
2356type SendChatActionMethod struct {
2357 ChatID ChatID `json:"chat_id" required:"true"`
2358 Action string `json:"action" required:"true"`
2359}
2360
2361// SendChatAction creates new Telegram Bot API method sendChatAction
2362// Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
2363func SendChatAction(chatID ChatID, action string) *SendChatActionMethod {
2364 return &SendChatActionMethod{
2365 ChatID: chatID,
2366 Action: action,
2367 }
2368}
2369
2370// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2371func (m *SendChatActionMethod) SetChatID(value ChatID) *SendChatActionMethod {
2372 m.ChatID = value
2373 return m
2374}
2375
2376// SetAction - Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.
2377func (m *SendChatActionMethod) SetAction(value string) *SendChatActionMethod {
2378 m.Action = value
2379 return m
2380}
2381
2382// Send is used to send request using Telegram Bot Client
2383func (m *SendChatActionMethod) Send(client *Client) (res *bool, err error) {
2384 return res, client.request("sendChatAction", m, &res)
2385}
2386
2387// GetUserProfilePhotosMethod represents Telegram Bot API method getUserProfilePhotos
2388// Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
2389type GetUserProfilePhotosMethod struct {
2390 UserID int `json:"user_id" required:"true"`
2391 Offset int `json:"offset"`
2392 Limit int `json:"limit"`
2393}
2394
2395// GetUserProfilePhotos creates new Telegram Bot API method getUserProfilePhotos
2396// Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
2397func GetUserProfilePhotos(userID int) *GetUserProfilePhotosMethod {
2398 return &GetUserProfilePhotosMethod{
2399 UserID: userID,
2400 }
2401}
2402
2403// SetUserID - Unique identifier of the target user
2404func (m *GetUserProfilePhotosMethod) SetUserID(value int) *GetUserProfilePhotosMethod {
2405 m.UserID = value
2406 return m
2407}
2408
2409// SetOffset - Sequential number of the first photo to be returned. By default, all photos are returned.
2410func (m *GetUserProfilePhotosMethod) SetOffset(value int) *GetUserProfilePhotosMethod {
2411 m.Offset = value
2412 return m
2413}
2414
2415// SetLimit - Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
2416func (m *GetUserProfilePhotosMethod) SetLimit(value int) *GetUserProfilePhotosMethod {
2417 m.Limit = value
2418 return m
2419}
2420
2421// Send is used to send request using Telegram Bot Client
2422func (m *GetUserProfilePhotosMethod) Send(client *Client) (res *UserProfilePhotos, err error) {
2423 return res, client.request("getUserProfilePhotos", m, &res)
2424}
2425
2426// GetFileMethod represents Telegram Bot API method getFile
2427// Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
2428type GetFileMethod struct {
2429 FileID string `json:"file_id" required:"true"`
2430}
2431
2432// GetFile creates new Telegram Bot API method getFile
2433// Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
2434func GetFile(fileID string) *GetFileMethod {
2435 return &GetFileMethod{
2436 FileID: fileID,
2437 }
2438}
2439
2440// SetFileID - File identifier to get info about
2441func (m *GetFileMethod) SetFileID(value string) *GetFileMethod {
2442 m.FileID = value
2443 return m
2444}
2445
2446// Send is used to send request using Telegram Bot Client
2447func (m *GetFileMethod) Send(client *Client) (res *File, err error) {
2448 return res, client.request("getFile", m, &res)
2449}
2450
2451// KickChatMemberMethod represents Telegram Bot API method kickChatMember
2452// Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2453type KickChatMemberMethod struct {
2454 ChatID ChatID `json:"chat_id" required:"true"`
2455 UserID int `json:"user_id" required:"true"`
2456 UntilDate int `json:"until_date"`
2457}
2458
2459// KickChatMember creates new Telegram Bot API method kickChatMember
2460// Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2461func KickChatMember(chatID ChatID, userID int) *KickChatMemberMethod {
2462 return &KickChatMemberMethod{
2463 ChatID: chatID,
2464 UserID: userID,
2465 }
2466}
2467
2468// SetChatID - Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
2469func (m *KickChatMemberMethod) SetChatID(value ChatID) *KickChatMemberMethod {
2470 m.ChatID = value
2471 return m
2472}
2473
2474// SetUserID - Unique identifier of the target user
2475func (m *KickChatMemberMethod) SetUserID(value int) *KickChatMemberMethod {
2476 m.UserID = value
2477 return m
2478}
2479
2480// SetUntilDate - Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
2481func (m *KickChatMemberMethod) SetUntilDate(value int) *KickChatMemberMethod {
2482 m.UntilDate = value
2483 return m
2484}
2485
2486// Send is used to send request using Telegram Bot Client
2487func (m *KickChatMemberMethod) Send(client *Client) (res *bool, err error) {
2488 return res, client.request("kickChatMember", m, &res)
2489}
2490
2491// UnbanChatMemberMethod represents Telegram Bot API method unbanChatMember
2492// Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.
2493type UnbanChatMemberMethod struct {
2494 ChatID ChatID `json:"chat_id" required:"true"`
2495 UserID int `json:"user_id" required:"true"`
2496}
2497
2498// UnbanChatMember creates new Telegram Bot API method unbanChatMember
2499// Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.
2500func UnbanChatMember(chatID ChatID, userID int) *UnbanChatMemberMethod {
2501 return &UnbanChatMemberMethod{
2502 ChatID: chatID,
2503 UserID: userID,
2504 }
2505}
2506
2507// SetChatID - Unique identifier for the target group or username of the target supergroup or channel (in the format @username)
2508func (m *UnbanChatMemberMethod) SetChatID(value ChatID) *UnbanChatMemberMethod {
2509 m.ChatID = value
2510 return m
2511}
2512
2513// SetUserID - Unique identifier of the target user
2514func (m *UnbanChatMemberMethod) SetUserID(value int) *UnbanChatMemberMethod {
2515 m.UserID = value
2516 return m
2517}
2518
2519// Send is used to send request using Telegram Bot Client
2520func (m *UnbanChatMemberMethod) Send(client *Client) (res *bool, err error) {
2521 return res, client.request("unbanChatMember", m, &res)
2522}
2523
2524// RestrictChatMemberMethod represents Telegram Bot API method restrictChatMember
2525// Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
2526type RestrictChatMemberMethod struct {
2527 ChatID ChatID `json:"chat_id" required:"true"`
2528 UserID int `json:"user_id" required:"true"`
2529 Permissions *ChatPermissions `json:"permissions" required:"true"`
2530 UntilDate int `json:"until_date"`
2531}
2532
2533// RestrictChatMember creates new Telegram Bot API method restrictChatMember
2534// Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
2535func RestrictChatMember(chatID ChatID, userID int, permissions *ChatPermissions) *RestrictChatMemberMethod {
2536 return &RestrictChatMemberMethod{
2537 ChatID: chatID,
2538 UserID: userID,
2539 Permissions: permissions,
2540 }
2541}
2542
2543// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2544func (m *RestrictChatMemberMethod) SetChatID(value ChatID) *RestrictChatMemberMethod {
2545 m.ChatID = value
2546 return m
2547}
2548
2549// SetUserID - Unique identifier of the target user
2550func (m *RestrictChatMemberMethod) SetUserID(value int) *RestrictChatMemberMethod {
2551 m.UserID = value
2552 return m
2553}
2554
2555// SetPermissions - New user permissions
2556func (m *RestrictChatMemberMethod) SetPermissions(value *ChatPermissions) *RestrictChatMemberMethod {
2557 m.Permissions = value
2558 return m
2559}
2560
2561// SetUntilDate - Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
2562func (m *RestrictChatMemberMethod) SetUntilDate(value int) *RestrictChatMemberMethod {
2563 m.UntilDate = value
2564 return m
2565}
2566
2567// Send is used to send request using Telegram Bot Client
2568func (m *RestrictChatMemberMethod) Send(client *Client) (res *bool, err error) {
2569 return res, client.request("restrictChatMember", m, &res)
2570}
2571
2572// PromoteChatMemberMethod represents Telegram Bot API method promoteChatMember
2573// Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
2574type PromoteChatMemberMethod struct {
2575 ChatID ChatID `json:"chat_id" required:"true"`
2576 UserID int `json:"user_id" required:"true"`
2577 CanChangeInfo bool `json:"can_change_info"`
2578 CanPostMessages bool `json:"can_post_messages"`
2579 CanEditMessages bool `json:"can_edit_messages"`
2580 CanDeleteMessages bool `json:"can_delete_messages"`
2581 CanInviteUsers bool `json:"can_invite_users"`
2582 CanRestrictMembers bool `json:"can_restrict_members"`
2583 CanPinMessages bool `json:"can_pin_messages"`
2584 CanPromoteMembers bool `json:"can_promote_members"`
2585}
2586
2587// PromoteChatMember creates new Telegram Bot API method promoteChatMember
2588// Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
2589func PromoteChatMember(chatID ChatID, userID int) *PromoteChatMemberMethod {
2590 return &PromoteChatMemberMethod{
2591 ChatID: chatID,
2592 UserID: userID,
2593 }
2594}
2595
2596// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2597func (m *PromoteChatMemberMethod) SetChatID(value ChatID) *PromoteChatMemberMethod {
2598 m.ChatID = value
2599 return m
2600}
2601
2602// SetUserID - Unique identifier of the target user
2603func (m *PromoteChatMemberMethod) SetUserID(value int) *PromoteChatMemberMethod {
2604 m.UserID = value
2605 return m
2606}
2607
2608// SetCanChangeInfo - Pass True, if the administrator can change chat title, photo and other settings
2609func (m *PromoteChatMemberMethod) SetCanChangeInfo(value bool) *PromoteChatMemberMethod {
2610 m.CanChangeInfo = value
2611 return m
2612}
2613
2614// SetCanPostMessages - Pass True, if the administrator can create channel posts, channels only
2615func (m *PromoteChatMemberMethod) SetCanPostMessages(value bool) *PromoteChatMemberMethod {
2616 m.CanPostMessages = value
2617 return m
2618}
2619
2620// SetCanEditMessages - Pass True, if the administrator can edit messages of other users and can pin messages, channels only
2621func (m *PromoteChatMemberMethod) SetCanEditMessages(value bool) *PromoteChatMemberMethod {
2622 m.CanEditMessages = value
2623 return m
2624}
2625
2626// SetCanDeleteMessages - Pass True, if the administrator can delete messages of other users
2627func (m *PromoteChatMemberMethod) SetCanDeleteMessages(value bool) *PromoteChatMemberMethod {
2628 m.CanDeleteMessages = value
2629 return m
2630}
2631
2632// SetCanInviteUsers - Pass True, if the administrator can invite new users to the chat
2633func (m *PromoteChatMemberMethod) SetCanInviteUsers(value bool) *PromoteChatMemberMethod {
2634 m.CanInviteUsers = value
2635 return m
2636}
2637
2638// SetCanRestrictMembers - Pass True, if the administrator can restrict, ban or unban chat members
2639func (m *PromoteChatMemberMethod) SetCanRestrictMembers(value bool) *PromoteChatMemberMethod {
2640 m.CanRestrictMembers = value
2641 return m
2642}
2643
2644// SetCanPinMessages - Pass True, if the administrator can pin messages, supergroups only
2645func (m *PromoteChatMemberMethod) SetCanPinMessages(value bool) *PromoteChatMemberMethod {
2646 m.CanPinMessages = value
2647 return m
2648}
2649
2650// SetCanPromoteMembers - Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
2651func (m *PromoteChatMemberMethod) SetCanPromoteMembers(value bool) *PromoteChatMemberMethod {
2652 m.CanPromoteMembers = value
2653 return m
2654}
2655
2656// Send is used to send request using Telegram Bot Client
2657func (m *PromoteChatMemberMethod) Send(client *Client) (res *bool, err error) {
2658 return res, client.request("promoteChatMember", m, &res)
2659}
2660
2661// SetChatAdministratorCustomTitleMethod represents Telegram Bot API method setChatAdministratorCustomTitle
2662// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
2663type SetChatAdministratorCustomTitleMethod struct {
2664 ChatID ChatID `json:"chat_id" required:"true"`
2665 UserID int `json:"user_id" required:"true"`
2666 CustomTitle string `json:"custom_title" required:"true"`
2667}
2668
2669// SetChatAdministratorCustomTitle creates new Telegram Bot API method setChatAdministratorCustomTitle
2670// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
2671func SetChatAdministratorCustomTitle(chatID ChatID, userID int, customTitle string) *SetChatAdministratorCustomTitleMethod {
2672 return &SetChatAdministratorCustomTitleMethod{
2673 ChatID: chatID,
2674 UserID: userID,
2675 CustomTitle: customTitle,
2676 }
2677}
2678
2679// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2680func (m *SetChatAdministratorCustomTitleMethod) SetChatID(value ChatID) *SetChatAdministratorCustomTitleMethod {
2681 m.ChatID = value
2682 return m
2683}
2684
2685// SetUserID - Unique identifier of the target user
2686func (m *SetChatAdministratorCustomTitleMethod) SetUserID(value int) *SetChatAdministratorCustomTitleMethod {
2687 m.UserID = value
2688 return m
2689}
2690
2691// SetCustomTitle - New custom title for the administrator; 0-16 characters, emoji are not allowed
2692func (m *SetChatAdministratorCustomTitleMethod) SetCustomTitle(value string) *SetChatAdministratorCustomTitleMethod {
2693 m.CustomTitle = value
2694 return m
2695}
2696
2697// Send is used to send request using Telegram Bot Client
2698func (m *SetChatAdministratorCustomTitleMethod) Send(client *Client) (res *bool, err error) {
2699 return res, client.request("setChatAdministratorCustomTitle", m, &res)
2700}
2701
2702// SetChatPermissionsMethod represents Telegram Bot API method setChatPermissions
2703// Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success.
2704type SetChatPermissionsMethod struct {
2705 ChatID ChatID `json:"chat_id" required:"true"`
2706 Permissions *ChatPermissions `json:"permissions" required:"true"`
2707}
2708
2709// SetChatPermissions creates new Telegram Bot API method setChatPermissions
2710// Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success.
2711func SetChatPermissions(chatID ChatID, permissions *ChatPermissions) *SetChatPermissionsMethod {
2712 return &SetChatPermissionsMethod{
2713 ChatID: chatID,
2714 Permissions: permissions,
2715 }
2716}
2717
2718// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2719func (m *SetChatPermissionsMethod) SetChatID(value ChatID) *SetChatPermissionsMethod {
2720 m.ChatID = value
2721 return m
2722}
2723
2724// SetPermissions - New default chat permissions
2725func (m *SetChatPermissionsMethod) SetPermissions(value *ChatPermissions) *SetChatPermissionsMethod {
2726 m.Permissions = value
2727 return m
2728}
2729
2730// Send is used to send request using Telegram Bot Client
2731func (m *SetChatPermissionsMethod) Send(client *Client) (res *bool, err error) {
2732 return res, client.request("setChatPermissions", m, &res)
2733}
2734
2735// ExportChatInviteLinkMethod represents Telegram Bot API method exportChatInviteLink
2736// Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success.
2737type ExportChatInviteLinkMethod struct {
2738 ChatID ChatID `json:"chat_id" required:"true"`
2739}
2740
2741// ExportChatInviteLink creates new Telegram Bot API method exportChatInviteLink
2742// Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success.
2743func ExportChatInviteLink(chatID ChatID) *ExportChatInviteLinkMethod {
2744 return &ExportChatInviteLinkMethod{
2745 ChatID: chatID,
2746 }
2747}
2748
2749// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2750func (m *ExportChatInviteLinkMethod) SetChatID(value ChatID) *ExportChatInviteLinkMethod {
2751 m.ChatID = value
2752 return m
2753}
2754
2755// Send is used to send request using Telegram Bot Client
2756func (m *ExportChatInviteLinkMethod) Send(client *Client) (res *string, err error) {
2757 return res, client.request("exportChatInviteLink", m, &res)
2758}
2759
2760// SetChatPhotoMethod represents Telegram Bot API method setChatPhoto
2761// Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2762type SetChatPhotoMethod struct {
2763 ChatID ChatID `json:"chat_id" required:"true"`
2764 Photo InputFile `json:"photo" required:"true"`
2765}
2766
2767// SetChatPhoto creates new Telegram Bot API method setChatPhoto
2768// Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2769func SetChatPhoto(chatID ChatID, photo InputFile) *SetChatPhotoMethod {
2770 return &SetChatPhotoMethod{
2771 ChatID: chatID,
2772 Photo: photo,
2773 }
2774}
2775
2776// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2777func (m *SetChatPhotoMethod) SetChatID(value ChatID) *SetChatPhotoMethod {
2778 m.ChatID = value
2779 return m
2780}
2781
2782// SetPhoto - New chat photo, uploaded using multipart/form-data
2783func (m *SetChatPhotoMethod) SetPhoto(value InputFile) *SetChatPhotoMethod {
2784 m.Photo = value
2785 return m
2786}
2787
2788// Send is used to send request using Telegram Bot Client
2789func (m *SetChatPhotoMethod) Send(client *Client) (res *bool, err error) {
2790 return res, client.request("setChatPhoto", m, &res)
2791}
2792
2793// DeleteChatPhotoMethod represents Telegram Bot API method deleteChatPhoto
2794// Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2795type DeleteChatPhotoMethod struct {
2796 ChatID ChatID `json:"chat_id" required:"true"`
2797}
2798
2799// DeleteChatPhoto creates new Telegram Bot API method deleteChatPhoto
2800// Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2801func DeleteChatPhoto(chatID ChatID) *DeleteChatPhotoMethod {
2802 return &DeleteChatPhotoMethod{
2803 ChatID: chatID,
2804 }
2805}
2806
2807// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2808func (m *DeleteChatPhotoMethod) SetChatID(value ChatID) *DeleteChatPhotoMethod {
2809 m.ChatID = value
2810 return m
2811}
2812
2813// Send is used to send request using Telegram Bot Client
2814func (m *DeleteChatPhotoMethod) Send(client *Client) (res *bool, err error) {
2815 return res, client.request("deleteChatPhoto", m, &res)
2816}
2817
2818// SetChatTitleMethod represents Telegram Bot API method setChatTitle
2819// Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2820type SetChatTitleMethod struct {
2821 ChatID ChatID `json:"chat_id" required:"true"`
2822 Title string `json:"title" required:"true"`
2823}
2824
2825// SetChatTitle creates new Telegram Bot API method setChatTitle
2826// Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2827func SetChatTitle(chatID ChatID, title string) *SetChatTitleMethod {
2828 return &SetChatTitleMethod{
2829 ChatID: chatID,
2830 Title: title,
2831 }
2832}
2833
2834// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2835func (m *SetChatTitleMethod) SetChatID(value ChatID) *SetChatTitleMethod {
2836 m.ChatID = value
2837 return m
2838}
2839
2840// SetTitle - New chat title, 1-255 characters
2841func (m *SetChatTitleMethod) SetTitle(value string) *SetChatTitleMethod {
2842 m.Title = value
2843 return m
2844}
2845
2846// Send is used to send request using Telegram Bot Client
2847func (m *SetChatTitleMethod) Send(client *Client) (res *bool, err error) {
2848 return res, client.request("setChatTitle", m, &res)
2849}
2850
2851// SetChatDescriptionMethod represents Telegram Bot API method setChatDescription
2852// Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2853type SetChatDescriptionMethod struct {
2854 ChatID ChatID `json:"chat_id" required:"true"`
2855 Description string `json:"description"`
2856}
2857
2858// SetChatDescription creates new Telegram Bot API method setChatDescription
2859// Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2860func SetChatDescription(chatID ChatID) *SetChatDescriptionMethod {
2861 return &SetChatDescriptionMethod{
2862 ChatID: chatID,
2863 }
2864}
2865
2866// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2867func (m *SetChatDescriptionMethod) SetChatID(value ChatID) *SetChatDescriptionMethod {
2868 m.ChatID = value
2869 return m
2870}
2871
2872// SetDescription - New chat description, 0-255 characters
2873func (m *SetChatDescriptionMethod) SetDescription(value string) *SetChatDescriptionMethod {
2874 m.Description = value
2875 return m
2876}
2877
2878// Send is used to send request using Telegram Bot Client
2879func (m *SetChatDescriptionMethod) Send(client *Client) (res *bool, err error) {
2880 return res, client.request("setChatDescription", m, &res)
2881}
2882
2883// PinChatMessageMethod represents Telegram Bot API method pinChatMessage
2884// Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
2885type PinChatMessageMethod struct {
2886 ChatID ChatID `json:"chat_id" required:"true"`
2887 MessageID int `json:"message_id" required:"true"`
2888 DisableNotification bool `json:"disable_notification"`
2889}
2890
2891// PinChatMessage creates new Telegram Bot API method pinChatMessage
2892// Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
2893func PinChatMessage(chatID ChatID, messageID int) *PinChatMessageMethod {
2894 return &PinChatMessageMethod{
2895 ChatID: chatID,
2896 MessageID: messageID,
2897 }
2898}
2899
2900// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2901func (m *PinChatMessageMethod) SetChatID(value ChatID) *PinChatMessageMethod {
2902 m.ChatID = value
2903 return m
2904}
2905
2906// SetMessageID - Identifier of a message to pin
2907func (m *PinChatMessageMethod) SetMessageID(value int) *PinChatMessageMethod {
2908 m.MessageID = value
2909 return m
2910}
2911
2912// SetDisableNotification - Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels.
2913func (m *PinChatMessageMethod) SetDisableNotification(value bool) *PinChatMessageMethod {
2914 m.DisableNotification = value
2915 return m
2916}
2917
2918// Send is used to send request using Telegram Bot Client
2919func (m *PinChatMessageMethod) Send(client *Client) (res *bool, err error) {
2920 return res, client.request("pinChatMessage", m, &res)
2921}
2922
2923// UnpinChatMessageMethod represents Telegram Bot API method unpinChatMessage
2924// Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
2925type UnpinChatMessageMethod struct {
2926 ChatID ChatID `json:"chat_id" required:"true"`
2927}
2928
2929// UnpinChatMessage creates new Telegram Bot API method unpinChatMessage
2930// Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
2931func UnpinChatMessage(chatID ChatID) *UnpinChatMessageMethod {
2932 return &UnpinChatMessageMethod{
2933 ChatID: chatID,
2934 }
2935}
2936
2937// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2938func (m *UnpinChatMessageMethod) SetChatID(value ChatID) *UnpinChatMessageMethod {
2939 m.ChatID = value
2940 return m
2941}
2942
2943// Send is used to send request using Telegram Bot Client
2944func (m *UnpinChatMessageMethod) Send(client *Client) (res *bool, err error) {
2945 return res, client.request("unpinChatMessage", m, &res)
2946}
2947
2948// LeaveChatMethod represents Telegram Bot API method leaveChat
2949// Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
2950type LeaveChatMethod struct {
2951 ChatID ChatID `json:"chat_id" required:"true"`
2952}
2953
2954// LeaveChat creates new Telegram Bot API method leaveChat
2955// Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
2956func LeaveChat(chatID ChatID) *LeaveChatMethod {
2957 return &LeaveChatMethod{
2958 ChatID: chatID,
2959 }
2960}
2961
2962// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
2963func (m *LeaveChatMethod) SetChatID(value ChatID) *LeaveChatMethod {
2964 m.ChatID = value
2965 return m
2966}
2967
2968// Send is used to send request using Telegram Bot Client
2969func (m *LeaveChatMethod) Send(client *Client) (res *bool, err error) {
2970 return res, client.request("leaveChat", m, &res)
2971}
2972
2973// GetChatMethod represents Telegram Bot API method getChat
2974// Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
2975type GetChatMethod struct {
2976 ChatID ChatID `json:"chat_id" required:"true"`
2977}
2978
2979// GetChat creates new Telegram Bot API method getChat
2980// Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
2981func GetChat(chatID ChatID) *GetChatMethod {
2982 return &GetChatMethod{
2983 ChatID: chatID,
2984 }
2985}
2986
2987// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
2988func (m *GetChatMethod) SetChatID(value ChatID) *GetChatMethod {
2989 m.ChatID = value
2990 return m
2991}
2992
2993// Send is used to send request using Telegram Bot Client
2994func (m *GetChatMethod) Send(client *Client) (res *Chat, err error) {
2995 return res, client.request("getChat", m, &res)
2996}
2997
2998// GetChatAdministratorsMethod represents Telegram Bot API method getChatAdministrators
2999// Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
3000type GetChatAdministratorsMethod struct {
3001 ChatID ChatID `json:"chat_id" required:"true"`
3002}
3003
3004// GetChatAdministrators creates new Telegram Bot API method getChatAdministrators
3005// Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
3006func GetChatAdministrators(chatID ChatID) *GetChatAdministratorsMethod {
3007 return &GetChatAdministratorsMethod{
3008 ChatID: chatID,
3009 }
3010}
3011
3012// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3013func (m *GetChatAdministratorsMethod) SetChatID(value ChatID) *GetChatAdministratorsMethod {
3014 m.ChatID = value
3015 return m
3016}
3017
3018// Send is used to send request using Telegram Bot Client
3019func (m *GetChatAdministratorsMethod) Send(client *Client) (res []*ChatMember, err error) {
3020 return res, client.request("getChatAdministrators", m, &res)
3021}
3022
3023// GetChatMembersCountMethod represents Telegram Bot API method getChatMembersCount
3024// Use this method to get the number of members in a chat. Returns Int on success.
3025type GetChatMembersCountMethod struct {
3026 ChatID ChatID `json:"chat_id" required:"true"`
3027}
3028
3029// GetChatMembersCount creates new Telegram Bot API method getChatMembersCount
3030// Use this method to get the number of members in a chat. Returns Int on success.
3031func GetChatMembersCount(chatID ChatID) *GetChatMembersCountMethod {
3032 return &GetChatMembersCountMethod{
3033 ChatID: chatID,
3034 }
3035}
3036
3037// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3038func (m *GetChatMembersCountMethod) SetChatID(value ChatID) *GetChatMembersCountMethod {
3039 m.ChatID = value
3040 return m
3041}
3042
3043// Send is used to send request using Telegram Bot Client
3044func (m *GetChatMembersCountMethod) Send(client *Client) (res *int, err error) {
3045 return res, client.request("getChatMembersCount", m, &res)
3046}
3047
3048// GetChatMemberMethod represents Telegram Bot API method getChatMember
3049// Use this method to get information about a member of a chat. Returns a ChatMember object on success.
3050type GetChatMemberMethod struct {
3051 ChatID ChatID `json:"chat_id" required:"true"`
3052 UserID int `json:"user_id" required:"true"`
3053}
3054
3055// GetChatMember creates new Telegram Bot API method getChatMember
3056// Use this method to get information about a member of a chat. Returns a ChatMember object on success.
3057func GetChatMember(chatID ChatID, userID int) *GetChatMemberMethod {
3058 return &GetChatMemberMethod{
3059 ChatID: chatID,
3060 UserID: userID,
3061 }
3062}
3063
3064// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3065func (m *GetChatMemberMethod) SetChatID(value ChatID) *GetChatMemberMethod {
3066 m.ChatID = value
3067 return m
3068}
3069
3070// SetUserID - Unique identifier of the target user
3071func (m *GetChatMemberMethod) SetUserID(value int) *GetChatMemberMethod {
3072 m.UserID = value
3073 return m
3074}
3075
3076// Send is used to send request using Telegram Bot Client
3077func (m *GetChatMemberMethod) Send(client *Client) (res *ChatMember, err error) {
3078 return res, client.request("getChatMember", m, &res)
3079}
3080
3081// SetChatStickerSetMethod represents Telegram Bot API method setChatStickerSet
3082// Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
3083type SetChatStickerSetMethod struct {
3084 ChatID ChatID `json:"chat_id" required:"true"`
3085 StickerSetName string `json:"sticker_set_name" required:"true"`
3086}
3087
3088// SetChatStickerSet creates new Telegram Bot API method setChatStickerSet
3089// Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
3090func SetChatStickerSet(chatID ChatID, stickerSetName string) *SetChatStickerSetMethod {
3091 return &SetChatStickerSetMethod{
3092 ChatID: chatID,
3093 StickerSetName: stickerSetName,
3094 }
3095}
3096
3097// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
3098func (m *SetChatStickerSetMethod) SetChatID(value ChatID) *SetChatStickerSetMethod {
3099 m.ChatID = value
3100 return m
3101}
3102
3103// SetStickerSetName - Name of the sticker set to be set as the group sticker set
3104func (m *SetChatStickerSetMethod) SetStickerSetName(value string) *SetChatStickerSetMethod {
3105 m.StickerSetName = value
3106 return m
3107}
3108
3109// Send is used to send request using Telegram Bot Client
3110func (m *SetChatStickerSetMethod) Send(client *Client) (res *bool, err error) {
3111 return res, client.request("setChatStickerSet", m, &res)
3112}
3113
3114// DeleteChatStickerSetMethod represents Telegram Bot API method deleteChatStickerSet
3115// Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
3116type DeleteChatStickerSetMethod struct {
3117 ChatID ChatID `json:"chat_id" required:"true"`
3118}
3119
3120// DeleteChatStickerSet creates new Telegram Bot API method deleteChatStickerSet
3121// Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
3122func DeleteChatStickerSet(chatID ChatID) *DeleteChatStickerSetMethod {
3123 return &DeleteChatStickerSetMethod{
3124 ChatID: chatID,
3125 }
3126}
3127
3128// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
3129func (m *DeleteChatStickerSetMethod) SetChatID(value ChatID) *DeleteChatStickerSetMethod {
3130 m.ChatID = value
3131 return m
3132}
3133
3134// Send is used to send request using Telegram Bot Client
3135func (m *DeleteChatStickerSetMethod) Send(client *Client) (res *bool, err error) {
3136 return res, client.request("deleteChatStickerSet", m, &res)
3137}
3138
3139// AnswerCallbackQueryMethod represents Telegram Bot API method answerCallbackQuery
3140// Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
3141type AnswerCallbackQueryMethod struct {
3142 CallbackQueryID string `json:"callback_query_id" required:"true"`
3143 Text string `json:"text"`
3144 ShowAlert bool `json:"show_alert"`
3145 URL string `json:"url"`
3146 CacheTime int `json:"cache_time"`
3147}
3148
3149// AnswerCallbackQuery creates new Telegram Bot API method answerCallbackQuery
3150// Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
3151func AnswerCallbackQuery(callbackQueryID string) *AnswerCallbackQueryMethod {
3152 return &AnswerCallbackQueryMethod{
3153 CallbackQueryID: callbackQueryID,
3154 }
3155}
3156
3157// SetCallbackQueryID - Unique identifier for the query to be answered
3158func (m *AnswerCallbackQueryMethod) SetCallbackQueryID(value string) *AnswerCallbackQueryMethod {
3159 m.CallbackQueryID = value
3160 return m
3161}
3162
3163// SetText - Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
3164func (m *AnswerCallbackQueryMethod) SetText(value string) *AnswerCallbackQueryMethod {
3165 m.Text = value
3166 return m
3167}
3168
3169// SetShowAlert - If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
3170func (m *AnswerCallbackQueryMethod) SetShowAlert(value bool) *AnswerCallbackQueryMethod {
3171 m.ShowAlert = value
3172 return m
3173}
3174
3175// SetURL - URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button.Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
3176func (m *AnswerCallbackQueryMethod) SetURL(value string) *AnswerCallbackQueryMethod {
3177 m.URL = value
3178 return m
3179}
3180
3181// SetCacheTime - The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
3182func (m *AnswerCallbackQueryMethod) SetCacheTime(value int) *AnswerCallbackQueryMethod {
3183 m.CacheTime = value
3184 return m
3185}
3186
3187// Send is used to send request using Telegram Bot Client
3188func (m *AnswerCallbackQueryMethod) Send(client *Client) (res *bool, err error) {
3189 return res, client.request("answerCallbackQuery", m, &res)
3190}
3191
3192// EditMessageTextMethod represents Telegram Bot API method editMessageText
3193// Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3194type EditMessageTextMethod struct {
3195 ChatID ChatID `json:"chat_id"`
3196 MessageID int `json:"message_id"`
3197 InlineMessageID string `json:"inline_message_id"`
3198 Text string `json:"text" required:"true"`
3199 ParseMode string `json:"parse_mode"`
3200 DisableWebPagePreview bool `json:"disable_web_page_preview"`
3201 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3202}
3203
3204// EditMessageText creates new Telegram Bot API method editMessageText
3205// Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3206func EditMessageText(text string) *EditMessageTextMethod {
3207 return &EditMessageTextMethod{
3208 Text: text,
3209 }
3210}
3211
3212// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3213func (m *EditMessageTextMethod) SetChatID(value ChatID) *EditMessageTextMethod {
3214 m.ChatID = value
3215 return m
3216}
3217
3218// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3219func (m *EditMessageTextMethod) SetMessageID(value int) *EditMessageTextMethod {
3220 m.MessageID = value
3221 return m
3222}
3223
3224// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3225func (m *EditMessageTextMethod) SetInlineMessageID(value string) *EditMessageTextMethod {
3226 m.InlineMessageID = value
3227 return m
3228}
3229
3230// SetText - New text of the message, 1-4096 characters after entities parsing
3231func (m *EditMessageTextMethod) SetText(value string) *EditMessageTextMethod {
3232 m.Text = value
3233 return m
3234}
3235
3236// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
3237func (m *EditMessageTextMethod) SetParseMode(value string) *EditMessageTextMethod {
3238 m.ParseMode = value
3239 return m
3240}
3241
3242// SetDisableWebPagePreview - Disables link previews for links in this message
3243func (m *EditMessageTextMethod) SetDisableWebPagePreview(value bool) *EditMessageTextMethod {
3244 m.DisableWebPagePreview = value
3245 return m
3246}
3247
3248// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3249func (m *EditMessageTextMethod) SetReplyMarkup(value ReplyMarkup) *EditMessageTextMethod {
3250 m.ReplyMarkup = value
3251 return m
3252}
3253
3254// Send is used to send request using Telegram Bot Client
3255func (m *EditMessageTextMethod) Send(client *Client) (res *Message, err error) {
3256 return res, client.request("editMessageText", m, &res)
3257}
3258
3259// EditMessageCaptionMethod represents Telegram Bot API method editMessageCaption
3260// Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3261type EditMessageCaptionMethod struct {
3262 ChatID ChatID `json:"chat_id"`
3263 MessageID int `json:"message_id"`
3264 InlineMessageID string `json:"inline_message_id"`
3265 Caption string `json:"caption"`
3266 ParseMode string `json:"parse_mode"`
3267 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3268}
3269
3270// EditMessageCaption creates new Telegram Bot API method editMessageCaption
3271// Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3272func EditMessageCaption() *EditMessageCaptionMethod {
3273 return &EditMessageCaptionMethod{}
3274}
3275
3276// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3277func (m *EditMessageCaptionMethod) SetChatID(value ChatID) *EditMessageCaptionMethod {
3278 m.ChatID = value
3279 return m
3280}
3281
3282// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3283func (m *EditMessageCaptionMethod) SetMessageID(value int) *EditMessageCaptionMethod {
3284 m.MessageID = value
3285 return m
3286}
3287
3288// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3289func (m *EditMessageCaptionMethod) SetInlineMessageID(value string) *EditMessageCaptionMethod {
3290 m.InlineMessageID = value
3291 return m
3292}
3293
3294// SetCaption - New caption of the message, 0-1024 characters after entities parsing
3295func (m *EditMessageCaptionMethod) SetCaption(value string) *EditMessageCaptionMethod {
3296 m.Caption = value
3297 return m
3298}
3299
3300// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
3301func (m *EditMessageCaptionMethod) SetParseMode(value string) *EditMessageCaptionMethod {
3302 m.ParseMode = value
3303 return m
3304}
3305
3306// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3307func (m *EditMessageCaptionMethod) SetReplyMarkup(value ReplyMarkup) *EditMessageCaptionMethod {
3308 m.ReplyMarkup = value
3309 return m
3310}
3311
3312// Send is used to send request using Telegram Bot Client
3313func (m *EditMessageCaptionMethod) Send(client *Client) (res *Message, err error) {
3314 return res, client.request("editMessageCaption", m, &res)
3315}
3316
3317// EditMessageMediaMethod represents Telegram Bot API method editMessageMedia
3318// Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
3319type EditMessageMediaMethod struct {
3320 ChatID ChatID `json:"chat_id"`
3321 MessageID int `json:"message_id"`
3322 InlineMessageID string `json:"inline_message_id"`
3323 Media *InputMedia `json:"media" required:"true"`
3324 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3325}
3326
3327// EditMessageMedia creates new Telegram Bot API method editMessageMedia
3328// Use this method to edit animation, audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
3329func EditMessageMedia(media *InputMedia) *EditMessageMediaMethod {
3330 return &EditMessageMediaMethod{
3331 Media: media,
3332 }
3333}
3334
3335// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3336func (m *EditMessageMediaMethod) SetChatID(value ChatID) *EditMessageMediaMethod {
3337 m.ChatID = value
3338 return m
3339}
3340
3341// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3342func (m *EditMessageMediaMethod) SetMessageID(value int) *EditMessageMediaMethod {
3343 m.MessageID = value
3344 return m
3345}
3346
3347// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3348func (m *EditMessageMediaMethod) SetInlineMessageID(value string) *EditMessageMediaMethod {
3349 m.InlineMessageID = value
3350 return m
3351}
3352
3353// SetMedia - A JSON-serialized object for a new media content of the message
3354func (m *EditMessageMediaMethod) SetMedia(value *InputMedia) *EditMessageMediaMethod {
3355 m.Media = value
3356 return m
3357}
3358
3359// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
3360func (m *EditMessageMediaMethod) SetReplyMarkup(value ReplyMarkup) *EditMessageMediaMethod {
3361 m.ReplyMarkup = value
3362 return m
3363}
3364
3365// Send is used to send request using Telegram Bot Client
3366func (m *EditMessageMediaMethod) Send(client *Client) (res *Message, err error) {
3367 return res, client.request("editMessageMedia", m, &res)
3368}
3369
3370// EditMessageReplyMarkupMethod represents Telegram Bot API method editMessageReplyMarkup
3371// Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3372type EditMessageReplyMarkupMethod struct {
3373 ChatID ChatID `json:"chat_id"`
3374 MessageID int `json:"message_id"`
3375 InlineMessageID string `json:"inline_message_id"`
3376 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3377}
3378
3379// EditMessageReplyMarkup creates new Telegram Bot API method editMessageReplyMarkup
3380// Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
3381func EditMessageReplyMarkup() *EditMessageReplyMarkupMethod {
3382 return &EditMessageReplyMarkupMethod{}
3383}
3384
3385// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3386func (m *EditMessageReplyMarkupMethod) SetChatID(value ChatID) *EditMessageReplyMarkupMethod {
3387 m.ChatID = value
3388 return m
3389}
3390
3391// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3392func (m *EditMessageReplyMarkupMethod) SetMessageID(value int) *EditMessageReplyMarkupMethod {
3393 m.MessageID = value
3394 return m
3395}
3396
3397// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3398func (m *EditMessageReplyMarkupMethod) SetInlineMessageID(value string) *EditMessageReplyMarkupMethod {
3399 m.InlineMessageID = value
3400 return m
3401}
3402
3403// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3404func (m *EditMessageReplyMarkupMethod) SetReplyMarkup(value ReplyMarkup) *EditMessageReplyMarkupMethod {
3405 m.ReplyMarkup = value
3406 return m
3407}
3408
3409// Send is used to send request using Telegram Bot Client
3410func (m *EditMessageReplyMarkupMethod) Send(client *Client) (res *Message, err error) {
3411 return res, client.request("editMessageReplyMarkup", m, &res)
3412}
3413
3414// StopPollMethod represents Telegram Bot API method stopPoll
3415// Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
3416type StopPollMethod struct {
3417 ChatID ChatID `json:"chat_id" required:"true"`
3418 MessageID int `json:"message_id" required:"true"`
3419 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3420}
3421
3422// StopPoll creates new Telegram Bot API method stopPoll
3423// Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
3424func StopPoll(chatID ChatID, messageID int) *StopPollMethod {
3425 return &StopPollMethod{
3426 ChatID: chatID,
3427 MessageID: messageID,
3428 }
3429}
3430
3431// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3432func (m *StopPollMethod) SetChatID(value ChatID) *StopPollMethod {
3433 m.ChatID = value
3434 return m
3435}
3436
3437// SetMessageID - Identifier of the original message with the poll
3438func (m *StopPollMethod) SetMessageID(value int) *StopPollMethod {
3439 m.MessageID = value
3440 return m
3441}
3442
3443// SetReplyMarkup - A JSON-serialized object for a new message inline keyboard.
3444func (m *StopPollMethod) SetReplyMarkup(value ReplyMarkup) *StopPollMethod {
3445 m.ReplyMarkup = value
3446 return m
3447}
3448
3449// Send is used to send request using Telegram Bot Client
3450func (m *StopPollMethod) Send(client *Client) (res *Poll, err error) {
3451 return res, client.request("stopPoll", m, &res)
3452}
3453
3454// DeleteMessageMethod represents Telegram Bot API method deleteMessage
3455// Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.Returns True on success.
3456type DeleteMessageMethod struct {
3457 ChatID ChatID `json:"chat_id" required:"true"`
3458 MessageID int `json:"message_id" required:"true"`
3459}
3460
3461// DeleteMessage creates new Telegram Bot API method deleteMessage
3462// Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.Returns True on success.
3463func DeleteMessage(chatID ChatID, messageID int) *DeleteMessageMethod {
3464 return &DeleteMessageMethod{
3465 ChatID: chatID,
3466 MessageID: messageID,
3467 }
3468}
3469
3470// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3471func (m *DeleteMessageMethod) SetChatID(value ChatID) *DeleteMessageMethod {
3472 m.ChatID = value
3473 return m
3474}
3475
3476// SetMessageID - Identifier of the message to delete
3477func (m *DeleteMessageMethod) SetMessageID(value int) *DeleteMessageMethod {
3478 m.MessageID = value
3479 return m
3480}
3481
3482// Send is used to send request using Telegram Bot Client
3483func (m *DeleteMessageMethod) Send(client *Client) (res *bool, err error) {
3484 return res, client.request("deleteMessage", m, &res)
3485}
3486
3487// SendStickerMethod represents Telegram Bot API method sendSticker
3488// Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
3489type SendStickerMethod struct {
3490 ChatID ChatID `json:"chat_id" required:"true"`
3491 Sticker InputFile `json:"sticker" required:"true"`
3492 DisableNotification bool `json:"disable_notification"`
3493 ReplyToMessageID int `json:"reply_to_message_id"`
3494 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3495}
3496
3497// SendSticker creates new Telegram Bot API method sendSticker
3498// Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
3499func SendSticker(chatID ChatID, sticker InputFile) *SendStickerMethod {
3500 return &SendStickerMethod{
3501 ChatID: chatID,
3502 Sticker: sticker,
3503 }
3504}
3505
3506// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3507func (m *SendStickerMethod) SetChatID(value ChatID) *SendStickerMethod {
3508 m.ChatID = value
3509 return m
3510}
3511
3512// SetSticker - Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
3513func (m *SendStickerMethod) SetSticker(value InputFile) *SendStickerMethod {
3514 m.Sticker = value
3515 return m
3516}
3517
3518// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
3519func (m *SendStickerMethod) SetDisableNotification(value bool) *SendStickerMethod {
3520 m.DisableNotification = value
3521 return m
3522}
3523
3524// SetReplyToMessageID - If the message is a reply, ID of the original message
3525func (m *SendStickerMethod) SetReplyToMessageID(value int) *SendStickerMethod {
3526 m.ReplyToMessageID = value
3527 return m
3528}
3529
3530// SetReplyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
3531func (m *SendStickerMethod) SetReplyMarkup(value ReplyMarkup) *SendStickerMethod {
3532 m.ReplyMarkup = value
3533 return m
3534}
3535
3536// Send is used to send request using Telegram Bot Client
3537func (m *SendStickerMethod) Send(client *Client) (res *Message, err error) {
3538 return res, client.request("sendSticker", m, &res)
3539}
3540
3541// GetStickerSetMethod represents Telegram Bot API method getStickerSet
3542// Use this method to get a sticker set. On success, a StickerSet object is returned.
3543type GetStickerSetMethod struct {
3544 Name string `json:"name" required:"true"`
3545}
3546
3547// GetStickerSet creates new Telegram Bot API method getStickerSet
3548// Use this method to get a sticker set. On success, a StickerSet object is returned.
3549func GetStickerSet(name string) *GetStickerSetMethod {
3550 return &GetStickerSetMethod{
3551 Name: name,
3552 }
3553}
3554
3555// SetName - Name of the sticker set
3556func (m *GetStickerSetMethod) SetName(value string) *GetStickerSetMethod {
3557 m.Name = value
3558 return m
3559}
3560
3561// Send is used to send request using Telegram Bot Client
3562func (m *GetStickerSetMethod) Send(client *Client) (res *StickerSet, err error) {
3563 return res, client.request("getStickerSet", m, &res)
3564}
3565
3566// UploadStickerFileMethod represents Telegram Bot API method uploadStickerFile
3567// Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
3568type UploadStickerFileMethod struct {
3569 UserID int `json:"user_id" required:"true"`
3570 PngSticker InputFile `json:"png_sticker" required:"true"`
3571}
3572
3573// UploadStickerFile creates new Telegram Bot API method uploadStickerFile
3574// Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
3575func UploadStickerFile(userID int, pngSticker InputFile) *UploadStickerFileMethod {
3576 return &UploadStickerFileMethod{
3577 UserID: userID,
3578 PngSticker: pngSticker,
3579 }
3580}
3581
3582// SetUserID - User identifier of sticker file owner
3583func (m *UploadStickerFileMethod) SetUserID(value int) *UploadStickerFileMethod {
3584 m.UserID = value
3585 return m
3586}
3587
3588// SetPngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. More info on Sending Files »
3589func (m *UploadStickerFileMethod) SetPngSticker(value InputFile) *UploadStickerFileMethod {
3590 m.PngSticker = value
3591 return m
3592}
3593
3594// Send is used to send request using Telegram Bot Client
3595func (m *UploadStickerFileMethod) Send(client *Client) (res *File, err error) {
3596 return res, client.request("uploadStickerFile", m, &res)
3597}
3598
3599// CreateNewStickerSetMethod represents Telegram Bot API method createNewStickerSet
3600// Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
3601type CreateNewStickerSetMethod struct {
3602 UserID int `json:"user_id" required:"true"`
3603 Name string `json:"name" required:"true"`
3604 Title string `json:"title" required:"true"`
3605 PngSticker InputFile `json:"png_sticker" required:"true"`
3606 Emojis string `json:"emojis" required:"true"`
3607 ContainsMasks bool `json:"contains_masks"`
3608 MaskPosition *MaskPosition `json:"mask_position"`
3609}
3610
3611// CreateNewStickerSet creates new Telegram Bot API method createNewStickerSet
3612// Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
3613func CreateNewStickerSet(userID int, name string, title string, pngSticker InputFile, emojis string) *CreateNewStickerSetMethod {
3614 return &CreateNewStickerSetMethod{
3615 UserID: userID,
3616 Name: name,
3617 Title: title,
3618 PngSticker: pngSticker,
3619 Emojis: emojis,
3620 }
3621}
3622
3623// SetUserID - User identifier of created sticker set owner
3624func (m *CreateNewStickerSetMethod) SetUserID(value int) *CreateNewStickerSetMethod {
3625 m.UserID = value
3626 return m
3627}
3628
3629// SetName - Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
3630func (m *CreateNewStickerSetMethod) SetName(value string) *CreateNewStickerSetMethod {
3631 m.Name = value
3632 return m
3633}
3634
3635// SetTitle - Sticker set title, 1-64 characters
3636func (m *CreateNewStickerSetMethod) SetTitle(value string) *CreateNewStickerSetMethod {
3637 m.Title = value
3638 return m
3639}
3640
3641// SetPngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
3642func (m *CreateNewStickerSetMethod) SetPngSticker(value InputFile) *CreateNewStickerSetMethod {
3643 m.PngSticker = value
3644 return m
3645}
3646
3647// SetEmojis - One or more emoji corresponding to the sticker
3648func (m *CreateNewStickerSetMethod) SetEmojis(value string) *CreateNewStickerSetMethod {
3649 m.Emojis = value
3650 return m
3651}
3652
3653// SetContainsMasks - Pass True, if a set of mask stickers should be created
3654func (m *CreateNewStickerSetMethod) SetContainsMasks(value bool) *CreateNewStickerSetMethod {
3655 m.ContainsMasks = value
3656 return m
3657}
3658
3659// SetMaskPosition - A JSON-serialized object for position where the mask should be placed on faces
3660func (m *CreateNewStickerSetMethod) SetMaskPosition(value *MaskPosition) *CreateNewStickerSetMethod {
3661 m.MaskPosition = value
3662 return m
3663}
3664
3665// Send is used to send request using Telegram Bot Client
3666func (m *CreateNewStickerSetMethod) Send(client *Client) (res *bool, err error) {
3667 return res, client.request("createNewStickerSet", m, &res)
3668}
3669
3670// AddStickerToSetMethod represents Telegram Bot API method addStickerToSet
3671// Use this method to add a new sticker to a set created by the bot. Returns True on success.
3672type AddStickerToSetMethod struct {
3673 UserID int `json:"user_id" required:"true"`
3674 Name string `json:"name" required:"true"`
3675 PngSticker InputFile `json:"png_sticker" required:"true"`
3676 Emojis string `json:"emojis" required:"true"`
3677 MaskPosition *MaskPosition `json:"mask_position"`
3678}
3679
3680// AddStickerToSet creates new Telegram Bot API method addStickerToSet
3681// Use this method to add a new sticker to a set created by the bot. Returns True on success.
3682func AddStickerToSet(userID int, name string, pngSticker InputFile, emojis string) *AddStickerToSetMethod {
3683 return &AddStickerToSetMethod{
3684 UserID: userID,
3685 Name: name,
3686 PngSticker: pngSticker,
3687 Emojis: emojis,
3688 }
3689}
3690
3691// SetUserID - User identifier of sticker set owner
3692func (m *AddStickerToSetMethod) SetUserID(value int) *AddStickerToSetMethod {
3693 m.UserID = value
3694 return m
3695}
3696
3697// SetName - Sticker set name
3698func (m *AddStickerToSetMethod) SetName(value string) *AddStickerToSetMethod {
3699 m.Name = value
3700 return m
3701}
3702
3703// SetPngSticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files »
3704func (m *AddStickerToSetMethod) SetPngSticker(value InputFile) *AddStickerToSetMethod {
3705 m.PngSticker = value
3706 return m
3707}
3708
3709// SetEmojis - One or more emoji corresponding to the sticker
3710func (m *AddStickerToSetMethod) SetEmojis(value string) *AddStickerToSetMethod {
3711 m.Emojis = value
3712 return m
3713}
3714
3715// SetMaskPosition - A JSON-serialized object for position where the mask should be placed on faces
3716func (m *AddStickerToSetMethod) SetMaskPosition(value *MaskPosition) *AddStickerToSetMethod {
3717 m.MaskPosition = value
3718 return m
3719}
3720
3721// Send is used to send request using Telegram Bot Client
3722func (m *AddStickerToSetMethod) Send(client *Client) (res *bool, err error) {
3723 return res, client.request("addStickerToSet", m, &res)
3724}
3725
3726// SetStickerPositionInSetMethod represents Telegram Bot API method setStickerPositionInSet
3727// Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
3728type SetStickerPositionInSetMethod struct {
3729 Sticker string `json:"sticker" required:"true"`
3730 Position int `json:"position" required:"true"`
3731}
3732
3733// SetStickerPositionInSet creates new Telegram Bot API method setStickerPositionInSet
3734// Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
3735func SetStickerPositionInSet(sticker string, position int) *SetStickerPositionInSetMethod {
3736 return &SetStickerPositionInSetMethod{
3737 Sticker: sticker,
3738 Position: position,
3739 }
3740}
3741
3742// SetSticker - File identifier of the sticker
3743func (m *SetStickerPositionInSetMethod) SetSticker(value string) *SetStickerPositionInSetMethod {
3744 m.Sticker = value
3745 return m
3746}
3747
3748// SetPosition - New sticker position in the set, zero-based
3749func (m *SetStickerPositionInSetMethod) SetPosition(value int) *SetStickerPositionInSetMethod {
3750 m.Position = value
3751 return m
3752}
3753
3754// Send is used to send request using Telegram Bot Client
3755func (m *SetStickerPositionInSetMethod) Send(client *Client) (res *bool, err error) {
3756 return res, client.request("setStickerPositionInSet", m, &res)
3757}
3758
3759// DeleteStickerFromSetMethod represents Telegram Bot API method deleteStickerFromSet
3760// Use this method to delete a sticker from a set created by the bot. Returns True on success.
3761type DeleteStickerFromSetMethod struct {
3762 Sticker string `json:"sticker" required:"true"`
3763}
3764
3765// DeleteStickerFromSet creates new Telegram Bot API method deleteStickerFromSet
3766// Use this method to delete a sticker from a set created by the bot. Returns True on success.
3767func DeleteStickerFromSet(sticker string) *DeleteStickerFromSetMethod {
3768 return &DeleteStickerFromSetMethod{
3769 Sticker: sticker,
3770 }
3771}
3772
3773// SetSticker - File identifier of the sticker
3774func (m *DeleteStickerFromSetMethod) SetSticker(value string) *DeleteStickerFromSetMethod {
3775 m.Sticker = value
3776 return m
3777}
3778
3779// Send is used to send request using Telegram Bot Client
3780func (m *DeleteStickerFromSetMethod) Send(client *Client) (res *bool, err error) {
3781 return res, client.request("deleteStickerFromSet", m, &res)
3782}
3783
3784// AnswerInlineQueryMethod represents Telegram Bot API method answerInlineQuery
3785// Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed.
3786type AnswerInlineQueryMethod struct {
3787 InlineQueryID string `json:"inline_query_id" required:"true"`
3788 Results []*InlineQueryResult `json:"results" required:"true"`
3789 CacheTime int `json:"cache_time"`
3790 IsPersonal bool `json:"is_personal"`
3791 NextOffset string `json:"next_offset"`
3792 SwitchPmText string `json:"switch_pm_text"`
3793 SwitchPmParameter string `json:"switch_pm_parameter"`
3794}
3795
3796// AnswerInlineQuery creates new Telegram Bot API method answerInlineQuery
3797// Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed.
3798func AnswerInlineQuery(inlineQueryID string, results []*InlineQueryResult) *AnswerInlineQueryMethod {
3799 return &AnswerInlineQueryMethod{
3800 InlineQueryID: inlineQueryID,
3801 Results: results,
3802 }
3803}
3804
3805// SetInlineQueryID - Unique identifier for the answered query
3806func (m *AnswerInlineQueryMethod) SetInlineQueryID(value string) *AnswerInlineQueryMethod {
3807 m.InlineQueryID = value
3808 return m
3809}
3810
3811// SetResults - A JSON-serialized array of results for the inline query
3812func (m *AnswerInlineQueryMethod) SetResults(value []*InlineQueryResult) *AnswerInlineQueryMethod {
3813 m.Results = value
3814 return m
3815}
3816
3817// SetCacheTime - The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
3818func (m *AnswerInlineQueryMethod) SetCacheTime(value int) *AnswerInlineQueryMethod {
3819 m.CacheTime = value
3820 return m
3821}
3822
3823// SetIsPersonal - Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
3824func (m *AnswerInlineQueryMethod) SetIsPersonal(value bool) *AnswerInlineQueryMethod {
3825 m.IsPersonal = value
3826 return m
3827}
3828
3829// SetNextOffset - Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
3830func (m *AnswerInlineQueryMethod) SetNextOffset(value string) *AnswerInlineQueryMethod {
3831 m.NextOffset = value
3832 return m
3833}
3834
3835// SetSwitchPmText - If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
3836func (m *AnswerInlineQueryMethod) SetSwitchPmText(value string) *AnswerInlineQueryMethod {
3837 m.SwitchPmText = value
3838 return m
3839}
3840
3841// SetSwitchPmParameter - Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a ‘Connect your YouTube account’ button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
3842func (m *AnswerInlineQueryMethod) SetSwitchPmParameter(value string) *AnswerInlineQueryMethod {
3843 m.SwitchPmParameter = value
3844 return m
3845}
3846
3847// Send is used to send request using Telegram Bot Client
3848func (m *AnswerInlineQueryMethod) Send(client *Client) (res *bool, err error) {
3849 return res, client.request("answerInlineQuery", m, &res)
3850}
3851
3852// SendInvoiceMethod represents Telegram Bot API method sendInvoice
3853// Use this method to send invoices. On success, the sent Message is returned.
3854type SendInvoiceMethod struct {
3855 ChatID int `json:"chat_id" required:"true"`
3856 Title string `json:"title" required:"true"`
3857 Description string `json:"description" required:"true"`
3858 Payload string `json:"payload" required:"true"`
3859 ProviderToken string `json:"provider_token" required:"true"`
3860 StartParameter string `json:"start_parameter" required:"true"`
3861 Currency string `json:"currency" required:"true"`
3862 Prices []*LabeledPrice `json:"prices" required:"true"`
3863 ProviderData string `json:"provider_data"`
3864 PhotoURL string `json:"photo_url"`
3865 PhotoSize int `json:"photo_size"`
3866 PhotoWidth int `json:"photo_width"`
3867 PhotoHeight int `json:"photo_height"`
3868 NeedName bool `json:"need_name"`
3869 NeedPhoneNumber bool `json:"need_phone_number"`
3870 NeedEmail bool `json:"need_email"`
3871 NeedShippingAddress bool `json:"need_shipping_address"`
3872 SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider"`
3873 SendEmailToProvider bool `json:"send_email_to_provider"`
3874 IsFlexible bool `json:"is_flexible"`
3875 DisableNotification bool `json:"disable_notification"`
3876 ReplyToMessageID int `json:"reply_to_message_id"`
3877 ReplyMarkup ReplyMarkup `json:"reply_markup"`
3878}
3879
3880// SendInvoice creates new Telegram Bot API method sendInvoice
3881// Use this method to send invoices. On success, the sent Message is returned.
3882func SendInvoice(chatID int, title string, description string, payload string, providerToken string, startParameter string, currency string, prices []*LabeledPrice) *SendInvoiceMethod {
3883 return &SendInvoiceMethod{
3884 ChatID: chatID,
3885 Title: title,
3886 Description: description,
3887 Payload: payload,
3888 ProviderToken: providerToken,
3889 StartParameter: startParameter,
3890 Currency: currency,
3891 Prices: prices,
3892 }
3893}
3894
3895// SetChatID - Unique identifier for the target private chat
3896func (m *SendInvoiceMethod) SetChatID(value int) *SendInvoiceMethod {
3897 m.ChatID = value
3898 return m
3899}
3900
3901// SetTitle - Product name, 1-32 characters
3902func (m *SendInvoiceMethod) SetTitle(value string) *SendInvoiceMethod {
3903 m.Title = value
3904 return m
3905}
3906
3907// SetDescription - Product description, 1-255 characters
3908func (m *SendInvoiceMethod) SetDescription(value string) *SendInvoiceMethod {
3909 m.Description = value
3910 return m
3911}
3912
3913// SetPayload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
3914func (m *SendInvoiceMethod) SetPayload(value string) *SendInvoiceMethod {
3915 m.Payload = value
3916 return m
3917}
3918
3919// SetProviderToken - Payments provider token, obtained via Botfather
3920func (m *SendInvoiceMethod) SetProviderToken(value string) *SendInvoiceMethod {
3921 m.ProviderToken = value
3922 return m
3923}
3924
3925// SetStartParameter - Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
3926func (m *SendInvoiceMethod) SetStartParameter(value string) *SendInvoiceMethod {
3927 m.StartParameter = value
3928 return m
3929}
3930
3931// SetCurrency - Three-letter ISO 4217 currency code, see more on currencies
3932func (m *SendInvoiceMethod) SetCurrency(value string) *SendInvoiceMethod {
3933 m.Currency = value
3934 return m
3935}
3936
3937// SetPrices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
3938func (m *SendInvoiceMethod) SetPrices(value []*LabeledPrice) *SendInvoiceMethod {
3939 m.Prices = value
3940 return m
3941}
3942
3943// SetProviderData - JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
3944func (m *SendInvoiceMethod) SetProviderData(value string) *SendInvoiceMethod {
3945 m.ProviderData = value
3946 return m
3947}
3948
3949// SetPhotoURL - URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
3950func (m *SendInvoiceMethod) SetPhotoURL(value string) *SendInvoiceMethod {
3951 m.PhotoURL = value
3952 return m
3953}
3954
3955// SetPhotoSize - Photo size
3956func (m *SendInvoiceMethod) SetPhotoSize(value int) *SendInvoiceMethod {
3957 m.PhotoSize = value
3958 return m
3959}
3960
3961// SetPhotoWidth - Photo width
3962func (m *SendInvoiceMethod) SetPhotoWidth(value int) *SendInvoiceMethod {
3963 m.PhotoWidth = value
3964 return m
3965}
3966
3967// SetPhotoHeight - Photo height
3968func (m *SendInvoiceMethod) SetPhotoHeight(value int) *SendInvoiceMethod {
3969 m.PhotoHeight = value
3970 return m
3971}
3972
3973// SetNeedName - Pass True, if you require the user's full name to complete the order
3974func (m *SendInvoiceMethod) SetNeedName(value bool) *SendInvoiceMethod {
3975 m.NeedName = value
3976 return m
3977}
3978
3979// SetNeedPhoneNumber - Pass True, if you require the user's phone number to complete the order
3980func (m *SendInvoiceMethod) SetNeedPhoneNumber(value bool) *SendInvoiceMethod {
3981 m.NeedPhoneNumber = value
3982 return m
3983}
3984
3985// SetNeedEmail - Pass True, if you require the user's email address to complete the order
3986func (m *SendInvoiceMethod) SetNeedEmail(value bool) *SendInvoiceMethod {
3987 m.NeedEmail = value
3988 return m
3989}
3990
3991// SetNeedShippingAddress - Pass True, if you require the user's shipping address to complete the order
3992func (m *SendInvoiceMethod) SetNeedShippingAddress(value bool) *SendInvoiceMethod {
3993 m.NeedShippingAddress = value
3994 return m
3995}
3996
3997// SetSendPhoneNumberToProvider - Pass True, if user's phone number should be sent to provider
3998func (m *SendInvoiceMethod) SetSendPhoneNumberToProvider(value bool) *SendInvoiceMethod {
3999 m.SendPhoneNumberToProvider = value
4000 return m
4001}
4002
4003// SetSendEmailToProvider - Pass True, if user's email address should be sent to provider
4004func (m *SendInvoiceMethod) SetSendEmailToProvider(value bool) *SendInvoiceMethod {
4005 m.SendEmailToProvider = value
4006 return m
4007}
4008
4009// SetIsFlexible - Pass True, if the final price depends on the shipping method
4010func (m *SendInvoiceMethod) SetIsFlexible(value bool) *SendInvoiceMethod {
4011 m.IsFlexible = value
4012 return m
4013}
4014
4015// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
4016func (m *SendInvoiceMethod) SetDisableNotification(value bool) *SendInvoiceMethod {
4017 m.DisableNotification = value
4018 return m
4019}
4020
4021// SetReplyToMessageID - If the message is a reply, ID of the original message
4022func (m *SendInvoiceMethod) SetReplyToMessageID(value int) *SendInvoiceMethod {
4023 m.ReplyToMessageID = value
4024 return m
4025}
4026
4027// SetReplyMarkup - A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.
4028func (m *SendInvoiceMethod) SetReplyMarkup(value ReplyMarkup) *SendInvoiceMethod {
4029 m.ReplyMarkup = value
4030 return m
4031}
4032
4033// Send is used to send request using Telegram Bot Client
4034func (m *SendInvoiceMethod) Send(client *Client) (res *Message, err error) {
4035 return res, client.request("sendInvoice", m, &res)
4036}
4037
4038// AnswerShippingQueryMethod represents Telegram Bot API method answerShippingQuery
4039// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
4040type AnswerShippingQueryMethod struct {
4041 ShippingQueryID string `json:"shipping_query_id" required:"true"`
4042 Ok bool `json:"ok" required:"true"`
4043 ShippingOptions []*ShippingOption `json:"shipping_options"`
4044 ErrorMessage string `json:"error_message"`
4045}
4046
4047// AnswerShippingQuery creates new Telegram Bot API method answerShippingQuery
4048// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
4049func AnswerShippingQuery(shippingQueryID string, ok bool) *AnswerShippingQueryMethod {
4050 return &AnswerShippingQueryMethod{
4051 ShippingQueryID: shippingQueryID,
4052 Ok: ok,
4053 }
4054}
4055
4056// SetShippingQueryID - Unique identifier for the query to be answered
4057func (m *AnswerShippingQueryMethod) SetShippingQueryID(value string) *AnswerShippingQueryMethod {
4058 m.ShippingQueryID = value
4059 return m
4060}
4061
4062// SetOk - Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
4063func (m *AnswerShippingQueryMethod) SetOk(value bool) *AnswerShippingQueryMethod {
4064 m.Ok = value
4065 return m
4066}
4067
4068// SetShippingOptions - Required if ok is True. A JSON-serialized array of available shipping options.
4069func (m *AnswerShippingQueryMethod) SetShippingOptions(value []*ShippingOption) *AnswerShippingQueryMethod {
4070 m.ShippingOptions = value
4071 return m
4072}
4073
4074// SetErrorMessage - Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
4075func (m *AnswerShippingQueryMethod) SetErrorMessage(value string) *AnswerShippingQueryMethod {
4076 m.ErrorMessage = value
4077 return m
4078}
4079
4080// Send is used to send request using Telegram Bot Client
4081func (m *AnswerShippingQueryMethod) Send(client *Client) (res *bool, err error) {
4082 return res, client.request("answerShippingQuery", m, &res)
4083}
4084
4085// AnswerPreCheckoutQueryMethod represents Telegram Bot API method answerPreCheckoutQuery
4086// Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
4087type AnswerPreCheckoutQueryMethod struct {
4088 PreCheckoutQueryID string `json:"pre_checkout_query_id" required:"true"`
4089 Ok bool `json:"ok" required:"true"`
4090 ErrorMessage string `json:"error_message"`
4091}
4092
4093// AnswerPreCheckoutQuery creates new Telegram Bot API method answerPreCheckoutQuery
4094// Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
4095func AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool) *AnswerPreCheckoutQueryMethod {
4096 return &AnswerPreCheckoutQueryMethod{
4097 PreCheckoutQueryID: preCheckoutQueryID,
4098 Ok: ok,
4099 }
4100}
4101
4102// SetPreCheckoutQueryID - Unique identifier for the query to be answered
4103func (m *AnswerPreCheckoutQueryMethod) SetPreCheckoutQueryID(value string) *AnswerPreCheckoutQueryMethod {
4104 m.PreCheckoutQueryID = value
4105 return m
4106}
4107
4108// SetOk - Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
4109func (m *AnswerPreCheckoutQueryMethod) SetOk(value bool) *AnswerPreCheckoutQueryMethod {
4110 m.Ok = value
4111 return m
4112}
4113
4114// SetErrorMessage - Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
4115func (m *AnswerPreCheckoutQueryMethod) SetErrorMessage(value string) *AnswerPreCheckoutQueryMethod {
4116 m.ErrorMessage = value
4117 return m
4118}
4119
4120// Send is used to send request using Telegram Bot Client
4121func (m *AnswerPreCheckoutQueryMethod) Send(client *Client) (res *bool, err error) {
4122 return res, client.request("answerPreCheckoutQuery", m, &res)
4123}
4124
4125// SetPassportDataErrorsMethod represents Telegram Bot API method setPassportDataErrors
4126// Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
4127type SetPassportDataErrorsMethod struct {
4128 UserID int `json:"user_id" required:"true"`
4129 Errors []*PassportElementError `json:"errors" required:"true"`
4130}
4131
4132// SetPassportDataErrors creates new Telegram Bot API method setPassportDataErrors
4133// Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
4134func SetPassportDataErrors(userID int, errors []*PassportElementError) *SetPassportDataErrorsMethod {
4135 return &SetPassportDataErrorsMethod{
4136 UserID: userID,
4137 Errors: errors,
4138 }
4139}
4140
4141// SetUserID - User identifier
4142func (m *SetPassportDataErrorsMethod) SetUserID(value int) *SetPassportDataErrorsMethod {
4143 m.UserID = value
4144 return m
4145}
4146
4147// SetErrors - A JSON-serialized array describing the errors
4148func (m *SetPassportDataErrorsMethod) SetErrors(value []*PassportElementError) *SetPassportDataErrorsMethod {
4149 m.Errors = value
4150 return m
4151}
4152
4153// Send is used to send request using Telegram Bot Client
4154func (m *SetPassportDataErrorsMethod) Send(client *Client) (res *bool, err error) {
4155 return res, client.request("setPassportDataErrors", m, &res)
4156}
4157
4158// SendGameMethod represents Telegram Bot API method sendGame
4159// Use this method to send a game. On success, the sent Message is returned.
4160type SendGameMethod struct {
4161 ChatID int `json:"chat_id" required:"true"`
4162 GameShortName string `json:"game_short_name" required:"true"`
4163 DisableNotification bool `json:"disable_notification"`
4164 ReplyToMessageID int `json:"reply_to_message_id"`
4165 ReplyMarkup ReplyMarkup `json:"reply_markup"`
4166}
4167
4168// SendGame creates new Telegram Bot API method sendGame
4169// Use this method to send a game. On success, the sent Message is returned.
4170func SendGame(chatID int, gameShortName string) *SendGameMethod {
4171 return &SendGameMethod{
4172 ChatID: chatID,
4173 GameShortName: gameShortName,
4174 }
4175}
4176
4177// SetChatID - Unique identifier for the target chat
4178func (m *SendGameMethod) SetChatID(value int) *SendGameMethod {
4179 m.ChatID = value
4180 return m
4181}
4182
4183// SetGameShortName - Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
4184func (m *SendGameMethod) SetGameShortName(value string) *SendGameMethod {
4185 m.GameShortName = value
4186 return m
4187}
4188
4189// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
4190func (m *SendGameMethod) SetDisableNotification(value bool) *SendGameMethod {
4191 m.DisableNotification = value
4192 return m
4193}
4194
4195// SetReplyToMessageID - If the message is a reply, ID of the original message
4196func (m *SendGameMethod) SetReplyToMessageID(value int) *SendGameMethod {
4197 m.ReplyToMessageID = value
4198 return m
4199}
4200
4201// SetReplyMarkup - A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game.
4202func (m *SendGameMethod) SetReplyMarkup(value ReplyMarkup) *SendGameMethod {
4203 m.ReplyMarkup = value
4204 return m
4205}
4206
4207// Send is used to send request using Telegram Bot Client
4208func (m *SendGameMethod) Send(client *Client) (res *Message, err error) {
4209 return res, client.request("sendGame", m, &res)
4210}
4211
4212// SetGameScoreMethod represents Telegram Bot API method setGameScore
4213// Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
4214type SetGameScoreMethod struct {
4215 UserID int `json:"user_id" required:"true"`
4216 Score int `json:"score" required:"true"`
4217 Force bool `json:"force"`
4218 DisableEditMessage bool `json:"disable_edit_message"`
4219 ChatID int `json:"chat_id"`
4220 MessageID int `json:"message_id"`
4221 InlineMessageID string `json:"inline_message_id"`
4222}
4223
4224// SetGameScore creates new Telegram Bot API method setGameScore
4225// Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
4226func SetGameScore(userID int, score int) *SetGameScoreMethod {
4227 return &SetGameScoreMethod{
4228 UserID: userID,
4229 Score: score,
4230 }
4231}
4232
4233// SetUserID - User identifier
4234func (m *SetGameScoreMethod) SetUserID(value int) *SetGameScoreMethod {
4235 m.UserID = value
4236 return m
4237}
4238
4239// SetScore - New score, must be non-negative
4240func (m *SetGameScoreMethod) SetScore(value int) *SetGameScoreMethod {
4241 m.Score = value
4242 return m
4243}
4244
4245// SetForce - Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
4246func (m *SetGameScoreMethod) SetForce(value bool) *SetGameScoreMethod {
4247 m.Force = value
4248 return m
4249}
4250
4251// SetDisableEditMessage - Pass True, if the game message should not be automatically edited to include the current scoreboard
4252func (m *SetGameScoreMethod) SetDisableEditMessage(value bool) *SetGameScoreMethod {
4253 m.DisableEditMessage = value
4254 return m
4255}
4256
4257// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat
4258func (m *SetGameScoreMethod) SetChatID(value int) *SetGameScoreMethod {
4259 m.ChatID = value
4260 return m
4261}
4262
4263// SetMessageID - Required if inline_message_id is not specified. Identifier of the sent message
4264func (m *SetGameScoreMethod) SetMessageID(value int) *SetGameScoreMethod {
4265 m.MessageID = value
4266 return m
4267}
4268
4269// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
4270func (m *SetGameScoreMethod) SetInlineMessageID(value string) *SetGameScoreMethod {
4271 m.InlineMessageID = value
4272 return m
4273}
4274
4275// Send is used to send request using Telegram Bot Client
4276func (m *SetGameScoreMethod) Send(client *Client) (res *Message, err error) {
4277 return res, client.request("setGameScore", m, &res)
4278}
4279
4280// GetGameHighScoresMethod represents Telegram Bot API method getGameHighScores
4281// Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
4282type GetGameHighScoresMethod struct {
4283 UserID int `json:"user_id" required:"true"`
4284 ChatID int `json:"chat_id"`
4285 MessageID int `json:"message_id"`
4286 InlineMessageID string `json:"inline_message_id"`
4287}
4288
4289// GetGameHighScores creates new Telegram Bot API method getGameHighScores
4290// Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
4291func GetGameHighScores(userID int) *GetGameHighScoresMethod {
4292 return &GetGameHighScoresMethod{
4293 UserID: userID,
4294 }
4295}
4296
4297// SetUserID - Target user id
4298func (m *GetGameHighScoresMethod) SetUserID(value int) *GetGameHighScoresMethod {
4299 m.UserID = value
4300 return m
4301}
4302
4303// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat
4304func (m *GetGameHighScoresMethod) SetChatID(value int) *GetGameHighScoresMethod {
4305 m.ChatID = value
4306 return m
4307}
4308
4309// SetMessageID - Required if inline_message_id is not specified. Identifier of the sent message
4310func (m *GetGameHighScoresMethod) SetMessageID(value int) *GetGameHighScoresMethod {
4311 m.MessageID = value
4312 return m
4313}
4314
4315// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
4316func (m *GetGameHighScoresMethod) SetInlineMessageID(value string) *GetGameHighScoresMethod {
4317 m.InlineMessageID = value
4318 return m
4319}
4320
4321// Send is used to send request using Telegram Bot Client
4322func (m *GetGameHighScoresMethod) Send(client *Client) (res []*GameHighScore, err error) {
4323 return res, client.request("getGameHighScores", m, &res)
4324}