· 5 years ago · Feb 24, 2020, 07:48 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 bot
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// Client represents telegram bot client
1027type Client interface {
1028 Send(string, interface{}, interface{}) error
1029}
1030
1031// GetUpdatesMethod represents Telegram Bot API method getUpdates
1032// Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
1033type GetUpdatesMethod struct {
1034 Offset int `json:"offset"`
1035 Limit int `json:"limit"`
1036 Timeout int `json:"timeout"`
1037 AllowedUpdates []string `json:"allowed_updates"`
1038}
1039
1040// GetUpdates creates new Telegram Bot API method getUpdates
1041// Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
1042func GetUpdates() *GetUpdatesMethod {
1043 return &GetUpdatesMethod{}
1044}
1045
1046// 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.
1047func (m *GetUpdatesMethod) SetOffset(value int) *GetUpdatesMethod {
1048 m.Offset = value
1049 return m
1050}
1051
1052// SetLimit - Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.
1053func (m *GetUpdatesMethod) SetLimit(value int) *GetUpdatesMethod {
1054 m.Limit = value
1055 return m
1056}
1057
1058// 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.
1059func (m *GetUpdatesMethod) SetTimeout(value int) *GetUpdatesMethod {
1060 m.Timeout = value
1061 return m
1062}
1063
1064// 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.
1065func (m *GetUpdatesMethod) SetAllowedUpdates(value []string) *GetUpdatesMethod {
1066 m.AllowedUpdates = value
1067 return m
1068}
1069
1070// Send is used to send request using Telegram Bot Client
1071func (m *GetUpdatesMethod) Send(client Client) (res []*Update, err error) {
1072 return res, client.Send("getUpdates", m, res)
1073}
1074
1075// SetWebhookMethod represents Telegram Bot API method setWebhook
1076// 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.
1077type SetWebhookMethod struct {
1078 URL string `json:"url"`
1079 Certificate *InputFile `json:"certificate"`
1080 MaxConnections int `json:"max_connections"`
1081 AllowedUpdates []string `json:"allowed_updates"`
1082}
1083
1084// SetWebhook creates new Telegram Bot API method setWebhook
1085// 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.
1086func SetWebhook(uRL string) *SetWebhookMethod {
1087 return &SetWebhookMethod{
1088 URL: uRL,
1089 }
1090}
1091
1092// SetURL - HTTPS url to send updates to. Use an empty string to remove webhook integration
1093func (m *SetWebhookMethod) SetURL(value string) *SetWebhookMethod {
1094 m.URL = value
1095 return m
1096}
1097
1098// SetCertificate - Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
1099func (m *SetWebhookMethod) SetCertificate(value *InputFile) *SetWebhookMethod {
1100 m.Certificate = value
1101 return m
1102}
1103
1104// 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.
1105func (m *SetWebhookMethod) SetMaxConnections(value int) *SetWebhookMethod {
1106 m.MaxConnections = value
1107 return m
1108}
1109
1110// 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.
1111func (m *SetWebhookMethod) SetAllowedUpdates(value []string) *SetWebhookMethod {
1112 m.AllowedUpdates = value
1113 return m
1114}
1115
1116// Send is used to send request using Telegram Bot Client
1117func (m *SetWebhookMethod) Send(client Client) (res *Update, err error) {
1118 return res, client.Send("setWebhook", m, res)
1119}
1120
1121// DeleteWebhookMethod represents 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.
1123type DeleteWebhookMethod struct {
1124}
1125
1126// DeleteWebhook creates new Telegram Bot API method deleteWebhook
1127// Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
1128func DeleteWebhook() *DeleteWebhookMethod {
1129 return &DeleteWebhookMethod{}
1130}
1131
1132// Send is used to send request using Telegram Bot Client
1133func (m *DeleteWebhookMethod) Send(client Client) (res *bool, err error) {
1134 return res, client.Send("deleteWebhook", m, res)
1135}
1136
1137// GetWebhookInfoMethod represents 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.
1139type GetWebhookInfoMethod struct {
1140}
1141
1142// GetWebhookInfo creates new Telegram Bot API method getWebhookInfo
1143// 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.
1144func GetWebhookInfo() *GetWebhookInfoMethod {
1145 return &GetWebhookInfoMethod{}
1146}
1147
1148// Send is used to send request using Telegram Bot Client
1149func (m *GetWebhookInfoMethod) Send(client Client) (res *WebhookInfo, err error) {
1150 return res, client.Send("getWebhookInfo", m, res)
1151}
1152
1153// GetMeMethod represents 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.
1155type GetMeMethod struct {
1156}
1157
1158// GetMe creates new Telegram Bot API method getMe
1159// 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.
1160func GetMe() *GetMeMethod {
1161 return &GetMeMethod{}
1162}
1163
1164// Send is used to send request using Telegram Bot Client
1165func (m *GetMeMethod) Send(client Client) (res *User, err error) {
1166 return res, client.Send("getMe", m, res)
1167}
1168
1169// SendMessageMethod represents Telegram Bot API method sendMessage
1170// Use this method to send text messages. On success, the sent Message is returned.
1171type SendMessageMethod struct {
1172 ChatID ChatID `json:"chat_id"`
1173 Text string `json:"text"`
1174 ParseMode string `json:"parse_mode"`
1175 DisableWebPagePreview bool `json:"disable_web_page_preview"`
1176 DisableNotification bool `json:"disable_notification"`
1177 ReplyToMessageID int `json:"reply_to_message_id"`
1178 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1179}
1180
1181// SendMessage creates new Telegram Bot API method sendMessage
1182// Use this method to send text messages. On success, the sent Message is returned.
1183func SendMessage(chatID ChatID, text string) *SendMessageMethod {
1184 return &SendMessageMethod{
1185 ChatID: chatID,
1186 Text: text,
1187 }
1188}
1189
1190// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1191func (m *SendMessageMethod) SetChatID(value ChatID) *SendMessageMethod {
1192 m.ChatID = value
1193 return m
1194}
1195
1196// SetText - Text of the message to be sent, 1-4096 characters after entities parsing
1197func (m *SendMessageMethod) SetText(value string) *SendMessageMethod {
1198 m.Text = value
1199 return m
1200}
1201
1202// 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.
1203func (m *SendMessageMethod) SetParseMode(value string) *SendMessageMethod {
1204 m.ParseMode = value
1205 return m
1206}
1207
1208// SetDisableWebPagePreview - Disables link previews for links in this message
1209func (m *SendMessageMethod) SetDisableWebPagePreview(value bool) *SendMessageMethod {
1210 m.DisableWebPagePreview = value
1211 return m
1212}
1213
1214// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1215func (m *SendMessageMethod) SetDisableNotification(value bool) *SendMessageMethod {
1216 m.DisableNotification = value
1217 return m
1218}
1219
1220// SetReplyToMessageID - If the message is a reply, ID of the original message
1221func (m *SendMessageMethod) SetReplyToMessageID(value int) *SendMessageMethod {
1222 m.ReplyToMessageID = value
1223 return m
1224}
1225
1226// 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.
1227func (m *SendMessageMethod) SetReplyMarkup(value *ReplyMarkup) *SendMessageMethod {
1228 m.ReplyMarkup = value
1229 return m
1230}
1231
1232// Send is used to send request using Telegram Bot Client
1233func (m *SendMessageMethod) Send(client Client) (res *Message, err error) {
1234 return res, client.Send("sendMessage", m, res)
1235}
1236
1237// ForwardMessageMethod represents Telegram Bot API method forwardMessage
1238// Use this method to forward messages of any kind. On success, the sent Message is returned.
1239type ForwardMessageMethod struct {
1240 ChatID ChatID `json:"chat_id"`
1241 FromChatID ChatID `json:"from_chat_id"`
1242 DisableNotification bool `json:"disable_notification"`
1243 MessageID int `json:"message_id"`
1244}
1245
1246// ForwardMessage creates new Telegram Bot API method forwardMessage
1247// Use this method to forward messages of any kind. On success, the sent Message is returned.
1248func ForwardMessage(chatID ChatID, fromChatID ChatID, messageID int) *ForwardMessageMethod {
1249 return &ForwardMessageMethod{
1250 ChatID: chatID,
1251 FromChatID: fromChatID,
1252 MessageID: messageID,
1253 }
1254}
1255
1256// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1257func (m *ForwardMessageMethod) SetChatID(value ChatID) *ForwardMessageMethod {
1258 m.ChatID = value
1259 return m
1260}
1261
1262// SetFromChatID - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
1263func (m *ForwardMessageMethod) SetFromChatID(value ChatID) *ForwardMessageMethod {
1264 m.FromChatID = value
1265 return m
1266}
1267
1268// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1269func (m *ForwardMessageMethod) SetDisableNotification(value bool) *ForwardMessageMethod {
1270 m.DisableNotification = value
1271 return m
1272}
1273
1274// SetMessageID - Message identifier in the chat specified in from_chat_id
1275func (m *ForwardMessageMethod) SetMessageID(value int) *ForwardMessageMethod {
1276 m.MessageID = value
1277 return m
1278}
1279
1280// Send is used to send request using Telegram Bot Client
1281func (m *ForwardMessageMethod) Send(client Client) (res *Message, err error) {
1282 return res, client.Send("forwardMessage", m, res)
1283}
1284
1285// SendPhotoMethod represents Telegram Bot API method sendPhoto
1286// Use this method to send photos. On success, the sent Message is returned.
1287type SendPhotoMethod struct {
1288 ChatID ChatID `json:"chat_id"`
1289 Photo *InputFile `json:"photo"`
1290 Caption string `json:"caption"`
1291 ParseMode string `json:"parse_mode"`
1292 DisableNotification bool `json:"disable_notification"`
1293 ReplyToMessageID int `json:"reply_to_message_id"`
1294 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1295}
1296
1297// SendPhoto creates new Telegram Bot API method sendPhoto
1298// Use this method to send photos. On success, the sent Message is returned.
1299func SendPhoto(chatID ChatID, photo *InputFile) *SendPhotoMethod {
1300 return &SendPhotoMethod{
1301 ChatID: chatID,
1302 Photo: photo,
1303 }
1304}
1305
1306// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1307func (m *SendPhotoMethod) SetChatID(value ChatID) *SendPhotoMethod {
1308 m.ChatID = value
1309 return m
1310}
1311
1312// 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 »
1313func (m *SendPhotoMethod) SetPhoto(value *InputFile) *SendPhotoMethod {
1314 m.Photo = value
1315 return m
1316}
1317
1318// SetCaption - Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
1319func (m *SendPhotoMethod) SetCaption(value string) *SendPhotoMethod {
1320 m.Caption = value
1321 return m
1322}
1323
1324// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1325func (m *SendPhotoMethod) SetParseMode(value string) *SendPhotoMethod {
1326 m.ParseMode = value
1327 return m
1328}
1329
1330// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1331func (m *SendPhotoMethod) SetDisableNotification(value bool) *SendPhotoMethod {
1332 m.DisableNotification = value
1333 return m
1334}
1335
1336// SetReplyToMessageID - If the message is a reply, ID of the original message
1337func (m *SendPhotoMethod) SetReplyToMessageID(value int) *SendPhotoMethod {
1338 m.ReplyToMessageID = value
1339 return m
1340}
1341
1342// 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.
1343func (m *SendPhotoMethod) SetReplyMarkup(value *ReplyMarkup) *SendPhotoMethod {
1344 m.ReplyMarkup = value
1345 return m
1346}
1347
1348// Send is used to send request using Telegram Bot Client
1349func (m *SendPhotoMethod) Send(client Client) (res *Message, err error) {
1350 return res, client.Send("sendPhoto", m, res)
1351}
1352
1353// SendAudioMethod represents Telegram Bot API method sendAudio
1354// 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.
1355type SendAudioMethod struct {
1356 ChatID ChatID `json:"chat_id"`
1357 Audio *InputFile `json:"audio"`
1358 Caption string `json:"caption"`
1359 ParseMode string `json:"parse_mode"`
1360 Duration int `json:"duration"`
1361 Performer string `json:"performer"`
1362 Title string `json:"title"`
1363 Thumb *InputFile `json:"thumb"`
1364 DisableNotification bool `json:"disable_notification"`
1365 ReplyToMessageID int `json:"reply_to_message_id"`
1366 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1367}
1368
1369// SendAudio creates new Telegram Bot API method sendAudio
1370// 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.
1371func SendAudio(chatID ChatID, audio *InputFile) *SendAudioMethod {
1372 return &SendAudioMethod{
1373 ChatID: chatID,
1374 Audio: audio,
1375 }
1376}
1377
1378// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1379func (m *SendAudioMethod) SetChatID(value ChatID) *SendAudioMethod {
1380 m.ChatID = value
1381 return m
1382}
1383
1384// 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 »
1385func (m *SendAudioMethod) SetAudio(value *InputFile) *SendAudioMethod {
1386 m.Audio = value
1387 return m
1388}
1389
1390// SetCaption - Audio caption, 0-1024 characters after entities parsing
1391func (m *SendAudioMethod) SetCaption(value string) *SendAudioMethod {
1392 m.Caption = value
1393 return m
1394}
1395
1396// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1397func (m *SendAudioMethod) SetParseMode(value string) *SendAudioMethod {
1398 m.ParseMode = value
1399 return m
1400}
1401
1402// SetDuration - Duration of the audio in seconds
1403func (m *SendAudioMethod) SetDuration(value int) *SendAudioMethod {
1404 m.Duration = value
1405 return m
1406}
1407
1408// SetPerformer - Performer
1409func (m *SendAudioMethod) SetPerformer(value string) *SendAudioMethod {
1410 m.Performer = value
1411 return m
1412}
1413
1414// SetTitle - Track name
1415func (m *SendAudioMethod) SetTitle(value string) *SendAudioMethod {
1416 m.Title = value
1417 return m
1418}
1419
1420// 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 »
1421func (m *SendAudioMethod) SetThumb(value *InputFile) *SendAudioMethod {
1422 m.Thumb = value
1423 return m
1424}
1425
1426// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1427func (m *SendAudioMethod) SetDisableNotification(value bool) *SendAudioMethod {
1428 m.DisableNotification = value
1429 return m
1430}
1431
1432// SetReplyToMessageID - If the message is a reply, ID of the original message
1433func (m *SendAudioMethod) SetReplyToMessageID(value int) *SendAudioMethod {
1434 m.ReplyToMessageID = value
1435 return m
1436}
1437
1438// 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.
1439func (m *SendAudioMethod) SetReplyMarkup(value *ReplyMarkup) *SendAudioMethod {
1440 m.ReplyMarkup = value
1441 return m
1442}
1443
1444// Send is used to send request using Telegram Bot Client
1445func (m *SendAudioMethod) Send(client Client) (res *Message, err error) {
1446 return res, client.Send("sendAudio", m, res)
1447}
1448
1449// SendDocumentMethod represents Telegram Bot API method sendDocument
1450// 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.
1451type SendDocumentMethod struct {
1452 ChatID ChatID `json:"chat_id"`
1453 Document *InputFile `json:"document"`
1454 Thumb *InputFile `json:"thumb"`
1455 Caption string `json:"caption"`
1456 ParseMode string `json:"parse_mode"`
1457 DisableNotification bool `json:"disable_notification"`
1458 ReplyToMessageID int `json:"reply_to_message_id"`
1459 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1460}
1461
1462// SendDocument creates new Telegram Bot API method sendDocument
1463// 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.
1464func SendDocument(chatID ChatID, document *InputFile) *SendDocumentMethod {
1465 return &SendDocumentMethod{
1466 ChatID: chatID,
1467 Document: document,
1468 }
1469}
1470
1471// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1472func (m *SendDocumentMethod) SetChatID(value ChatID) *SendDocumentMethod {
1473 m.ChatID = value
1474 return m
1475}
1476
1477// 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 »
1478func (m *SendDocumentMethod) SetDocument(value *InputFile) *SendDocumentMethod {
1479 m.Document = value
1480 return m
1481}
1482
1483// 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 »
1484func (m *SendDocumentMethod) SetThumb(value *InputFile) *SendDocumentMethod {
1485 m.Thumb = value
1486 return m
1487}
1488
1489// SetCaption - Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
1490func (m *SendDocumentMethod) SetCaption(value string) *SendDocumentMethod {
1491 m.Caption = value
1492 return m
1493}
1494
1495// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1496func (m *SendDocumentMethod) SetParseMode(value string) *SendDocumentMethod {
1497 m.ParseMode = value
1498 return m
1499}
1500
1501// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1502func (m *SendDocumentMethod) SetDisableNotification(value bool) *SendDocumentMethod {
1503 m.DisableNotification = value
1504 return m
1505}
1506
1507// SetReplyToMessageID - If the message is a reply, ID of the original message
1508func (m *SendDocumentMethod) SetReplyToMessageID(value int) *SendDocumentMethod {
1509 m.ReplyToMessageID = value
1510 return m
1511}
1512
1513// 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.
1514func (m *SendDocumentMethod) SetReplyMarkup(value *ReplyMarkup) *SendDocumentMethod {
1515 m.ReplyMarkup = value
1516 return m
1517}
1518
1519// Send is used to send request using Telegram Bot Client
1520func (m *SendDocumentMethod) Send(client Client) (res *Message, err error) {
1521 return res, client.Send("sendDocument", m, res)
1522}
1523
1524// SendVideoMethod represents Telegram Bot API method sendVideo
1525// 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.
1526type SendVideoMethod struct {
1527 ChatID ChatID `json:"chat_id"`
1528 Video *InputFile `json:"video"`
1529 Duration int `json:"duration"`
1530 Width int `json:"width"`
1531 Height int `json:"height"`
1532 Thumb *InputFile `json:"thumb"`
1533 Caption string `json:"caption"`
1534 ParseMode string `json:"parse_mode"`
1535 SupportsStreaming bool `json:"supports_streaming"`
1536 DisableNotification bool `json:"disable_notification"`
1537 ReplyToMessageID int `json:"reply_to_message_id"`
1538 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1539}
1540
1541// SendVideo creates new Telegram Bot API method sendVideo
1542// 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.
1543func SendVideo(chatID ChatID, video *InputFile) *SendVideoMethod {
1544 return &SendVideoMethod{
1545 ChatID: chatID,
1546 Video: video,
1547 }
1548}
1549
1550// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1551func (m *SendVideoMethod) SetChatID(value ChatID) *SendVideoMethod {
1552 m.ChatID = value
1553 return m
1554}
1555
1556// 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 »
1557func (m *SendVideoMethod) SetVideo(value *InputFile) *SendVideoMethod {
1558 m.Video = value
1559 return m
1560}
1561
1562// SetDuration - Duration of sent video in seconds
1563func (m *SendVideoMethod) SetDuration(value int) *SendVideoMethod {
1564 m.Duration = value
1565 return m
1566}
1567
1568// SetWidth - Video width
1569func (m *SendVideoMethod) SetWidth(value int) *SendVideoMethod {
1570 m.Width = value
1571 return m
1572}
1573
1574// SetHeight - Video height
1575func (m *SendVideoMethod) SetHeight(value int) *SendVideoMethod {
1576 m.Height = value
1577 return m
1578}
1579
1580// 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 »
1581func (m *SendVideoMethod) SetThumb(value *InputFile) *SendVideoMethod {
1582 m.Thumb = value
1583 return m
1584}
1585
1586// SetCaption - Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
1587func (m *SendVideoMethod) SetCaption(value string) *SendVideoMethod {
1588 m.Caption = value
1589 return m
1590}
1591
1592// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1593func (m *SendVideoMethod) SetParseMode(value string) *SendVideoMethod {
1594 m.ParseMode = value
1595 return m
1596}
1597
1598// SetSupportsStreaming - Pass True, if the uploaded video is suitable for streaming
1599func (m *SendVideoMethod) SetSupportsStreaming(value bool) *SendVideoMethod {
1600 m.SupportsStreaming = value
1601 return m
1602}
1603
1604// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1605func (m *SendVideoMethod) SetDisableNotification(value bool) *SendVideoMethod {
1606 m.DisableNotification = value
1607 return m
1608}
1609
1610// SetReplyToMessageID - If the message is a reply, ID of the original message
1611func (m *SendVideoMethod) SetReplyToMessageID(value int) *SendVideoMethod {
1612 m.ReplyToMessageID = value
1613 return m
1614}
1615
1616// 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.
1617func (m *SendVideoMethod) SetReplyMarkup(value *ReplyMarkup) *SendVideoMethod {
1618 m.ReplyMarkup = value
1619 return m
1620}
1621
1622// Send is used to send request using Telegram Bot Client
1623func (m *SendVideoMethod) Send(client Client) (res *Message, err error) {
1624 return res, client.Send("sendVideo", m, res)
1625}
1626
1627// SendAnimationMethod represents Telegram Bot API method sendAnimation
1628// 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.
1629type SendAnimationMethod struct {
1630 ChatID ChatID `json:"chat_id"`
1631 Animation *InputFile `json:"animation"`
1632 Duration int `json:"duration"`
1633 Width int `json:"width"`
1634 Height int `json:"height"`
1635 Thumb *InputFile `json:"thumb"`
1636 Caption string `json:"caption"`
1637 ParseMode string `json:"parse_mode"`
1638 DisableNotification bool `json:"disable_notification"`
1639 ReplyToMessageID int `json:"reply_to_message_id"`
1640 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1641}
1642
1643// SendAnimation creates new Telegram Bot API method sendAnimation
1644// 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.
1645func SendAnimation(chatID ChatID, animation *InputFile) *SendAnimationMethod {
1646 return &SendAnimationMethod{
1647 ChatID: chatID,
1648 Animation: animation,
1649 }
1650}
1651
1652// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1653func (m *SendAnimationMethod) SetChatID(value ChatID) *SendAnimationMethod {
1654 m.ChatID = value
1655 return m
1656}
1657
1658// 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 »
1659func (m *SendAnimationMethod) SetAnimation(value *InputFile) *SendAnimationMethod {
1660 m.Animation = value
1661 return m
1662}
1663
1664// SetDuration - Duration of sent animation in seconds
1665func (m *SendAnimationMethod) SetDuration(value int) *SendAnimationMethod {
1666 m.Duration = value
1667 return m
1668}
1669
1670// SetWidth - Animation width
1671func (m *SendAnimationMethod) SetWidth(value int) *SendAnimationMethod {
1672 m.Width = value
1673 return m
1674}
1675
1676// SetHeight - Animation height
1677func (m *SendAnimationMethod) SetHeight(value int) *SendAnimationMethod {
1678 m.Height = value
1679 return m
1680}
1681
1682// 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 »
1683func (m *SendAnimationMethod) SetThumb(value *InputFile) *SendAnimationMethod {
1684 m.Thumb = value
1685 return m
1686}
1687
1688// SetCaption - Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
1689func (m *SendAnimationMethod) SetCaption(value string) *SendAnimationMethod {
1690 m.Caption = value
1691 return m
1692}
1693
1694// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1695func (m *SendAnimationMethod) SetParseMode(value string) *SendAnimationMethod {
1696 m.ParseMode = value
1697 return m
1698}
1699
1700// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1701func (m *SendAnimationMethod) SetDisableNotification(value bool) *SendAnimationMethod {
1702 m.DisableNotification = value
1703 return m
1704}
1705
1706// SetReplyToMessageID - If the message is a reply, ID of the original message
1707func (m *SendAnimationMethod) SetReplyToMessageID(value int) *SendAnimationMethod {
1708 m.ReplyToMessageID = value
1709 return m
1710}
1711
1712// 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.
1713func (m *SendAnimationMethod) SetReplyMarkup(value *ReplyMarkup) *SendAnimationMethod {
1714 m.ReplyMarkup = value
1715 return m
1716}
1717
1718// Send is used to send request using Telegram Bot Client
1719func (m *SendAnimationMethod) Send(client Client) (res *Message, err error) {
1720 return res, client.Send("sendAnimation", m, res)
1721}
1722
1723// SendVoiceMethod represents Telegram Bot API method sendVoice
1724// 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.
1725type SendVoiceMethod struct {
1726 ChatID ChatID `json:"chat_id"`
1727 Voice *InputFile `json:"voice"`
1728 Caption string `json:"caption"`
1729 ParseMode string `json:"parse_mode"`
1730 Duration int `json:"duration"`
1731 DisableNotification bool `json:"disable_notification"`
1732 ReplyToMessageID int `json:"reply_to_message_id"`
1733 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1734}
1735
1736// SendVoice creates new Telegram Bot API method sendVoice
1737// 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.
1738func SendVoice(chatID ChatID, voice *InputFile) *SendVoiceMethod {
1739 return &SendVoiceMethod{
1740 ChatID: chatID,
1741 Voice: voice,
1742 }
1743}
1744
1745// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1746func (m *SendVoiceMethod) SetChatID(value ChatID) *SendVoiceMethod {
1747 m.ChatID = value
1748 return m
1749}
1750
1751// 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 »
1752func (m *SendVoiceMethod) SetVoice(value *InputFile) *SendVoiceMethod {
1753 m.Voice = value
1754 return m
1755}
1756
1757// SetCaption - Voice message caption, 0-1024 characters after entities parsing
1758func (m *SendVoiceMethod) SetCaption(value string) *SendVoiceMethod {
1759 m.Caption = value
1760 return m
1761}
1762
1763// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
1764func (m *SendVoiceMethod) SetParseMode(value string) *SendVoiceMethod {
1765 m.ParseMode = value
1766 return m
1767}
1768
1769// SetDuration - Duration of the voice message in seconds
1770func (m *SendVoiceMethod) SetDuration(value int) *SendVoiceMethod {
1771 m.Duration = value
1772 return m
1773}
1774
1775// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1776func (m *SendVoiceMethod) SetDisableNotification(value bool) *SendVoiceMethod {
1777 m.DisableNotification = value
1778 return m
1779}
1780
1781// SetReplyToMessageID - If the message is a reply, ID of the original message
1782func (m *SendVoiceMethod) SetReplyToMessageID(value int) *SendVoiceMethod {
1783 m.ReplyToMessageID = value
1784 return m
1785}
1786
1787// 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.
1788func (m *SendVoiceMethod) SetReplyMarkup(value *ReplyMarkup) *SendVoiceMethod {
1789 m.ReplyMarkup = value
1790 return m
1791}
1792
1793// Send is used to send request using Telegram Bot Client
1794func (m *SendVoiceMethod) Send(client Client) (res *Message, err error) {
1795 return res, client.Send("sendVoice", m, res)
1796}
1797
1798// SendVideoNoteMethod represents Telegram Bot API method sendVideoNote
1799// 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.
1800type SendVideoNoteMethod struct {
1801 ChatID ChatID `json:"chat_id"`
1802 VideoNote *InputFile `json:"video_note"`
1803 Duration int `json:"duration"`
1804 Length int `json:"length"`
1805 Thumb *InputFile `json:"thumb"`
1806 DisableNotification bool `json:"disable_notification"`
1807 ReplyToMessageID int `json:"reply_to_message_id"`
1808 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1809}
1810
1811// SendVideoNote creates new Telegram Bot API method sendVideoNote
1812// 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.
1813func SendVideoNote(chatID ChatID, videoNote *InputFile) *SendVideoNoteMethod {
1814 return &SendVideoNoteMethod{
1815 ChatID: chatID,
1816 VideoNote: videoNote,
1817 }
1818}
1819
1820// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1821func (m *SendVideoNoteMethod) SetChatID(value ChatID) *SendVideoNoteMethod {
1822 m.ChatID = value
1823 return m
1824}
1825
1826// 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
1827func (m *SendVideoNoteMethod) SetVideoNote(value *InputFile) *SendVideoNoteMethod {
1828 m.VideoNote = value
1829 return m
1830}
1831
1832// SetDuration - Duration of sent video in seconds
1833func (m *SendVideoNoteMethod) SetDuration(value int) *SendVideoNoteMethod {
1834 m.Duration = value
1835 return m
1836}
1837
1838// SetLength - Video width and height, i.e. diameter of the video message
1839func (m *SendVideoNoteMethod) SetLength(value int) *SendVideoNoteMethod {
1840 m.Length = value
1841 return m
1842}
1843
1844// 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 »
1845func (m *SendVideoNoteMethod) SetThumb(value *InputFile) *SendVideoNoteMethod {
1846 m.Thumb = value
1847 return m
1848}
1849
1850// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1851func (m *SendVideoNoteMethod) SetDisableNotification(value bool) *SendVideoNoteMethod {
1852 m.DisableNotification = value
1853 return m
1854}
1855
1856// SetReplyToMessageID - If the message is a reply, ID of the original message
1857func (m *SendVideoNoteMethod) SetReplyToMessageID(value int) *SendVideoNoteMethod {
1858 m.ReplyToMessageID = value
1859 return m
1860}
1861
1862// 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.
1863func (m *SendVideoNoteMethod) SetReplyMarkup(value *ReplyMarkup) *SendVideoNoteMethod {
1864 m.ReplyMarkup = value
1865 return m
1866}
1867
1868// Send is used to send request using Telegram Bot Client
1869func (m *SendVideoNoteMethod) Send(client Client) (res *Message, err error) {
1870 return res, client.Send("sendVideoNote", m, res)
1871}
1872
1873// SendMediaGroupMethod represents Telegram Bot API method sendMediaGroup
1874// Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
1875type SendMediaGroupMethod struct {
1876 ChatID ChatID `json:"chat_id"`
1877 Media InputMedia `json:"media"`
1878 DisableNotification bool `json:"disable_notification"`
1879 ReplyToMessageID int `json:"reply_to_message_id"`
1880}
1881
1882// SendMediaGroup creates new Telegram Bot API method sendMediaGroup
1883// Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
1884func SendMediaGroup(chatID ChatID, media InputMedia) *SendMediaGroupMethod {
1885 return &SendMediaGroupMethod{
1886 ChatID: chatID,
1887 Media: media,
1888 }
1889}
1890
1891// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1892func (m *SendMediaGroupMethod) SetChatID(value ChatID) *SendMediaGroupMethod {
1893 m.ChatID = value
1894 return m
1895}
1896
1897// SetMedia - A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
1898func (m *SendMediaGroupMethod) SetMedia(value InputMedia) *SendMediaGroupMethod {
1899 m.Media = value
1900 return m
1901}
1902
1903// SetDisableNotification - Sends the messages silently. Users will receive a notification with no sound.
1904func (m *SendMediaGroupMethod) SetDisableNotification(value bool) *SendMediaGroupMethod {
1905 m.DisableNotification = value
1906 return m
1907}
1908
1909// SetReplyToMessageID - If the messages are a reply, ID of the original message
1910func (m *SendMediaGroupMethod) SetReplyToMessageID(value int) *SendMediaGroupMethod {
1911 m.ReplyToMessageID = value
1912 return m
1913}
1914
1915// Send is used to send request using Telegram Bot Client
1916func (m *SendMediaGroupMethod) Send(client Client) (res []*Message, err error) {
1917 return res, client.Send("sendMediaGroup", m, res)
1918}
1919
1920// SendLocationMethod represents Telegram Bot API method sendLocation
1921// Use this method to send point on the map. On success, the sent Message is returned.
1922type SendLocationMethod struct {
1923 ChatID ChatID `json:"chat_id"`
1924 Latitude float64 `json:"latitude"`
1925 Longitude float64 `json:"longitude"`
1926 LivePeriod int `json:"live_period"`
1927 DisableNotification bool `json:"disable_notification"`
1928 ReplyToMessageID int `json:"reply_to_message_id"`
1929 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1930}
1931
1932// SendLocation creates new Telegram Bot API method sendLocation
1933// Use this method to send point on the map. On success, the sent Message is returned.
1934func SendLocation(chatID ChatID, latitude float64, longitude float64) *SendLocationMethod {
1935 return &SendLocationMethod{
1936 ChatID: chatID,
1937 Latitude: latitude,
1938 Longitude: longitude,
1939 }
1940}
1941
1942// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1943func (m *SendLocationMethod) SetChatID(value ChatID) *SendLocationMethod {
1944 m.ChatID = value
1945 return m
1946}
1947
1948// SetLatitude - Latitude of the location
1949func (m *SendLocationMethod) SetLatitude(value float64) *SendLocationMethod {
1950 m.Latitude = value
1951 return m
1952}
1953
1954// SetLongitude - Longitude of the location
1955func (m *SendLocationMethod) SetLongitude(value float64) *SendLocationMethod {
1956 m.Longitude = value
1957 return m
1958}
1959
1960// SetLivePeriod - Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.
1961func (m *SendLocationMethod) SetLivePeriod(value int) *SendLocationMethod {
1962 m.LivePeriod = value
1963 return m
1964}
1965
1966// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
1967func (m *SendLocationMethod) SetDisableNotification(value bool) *SendLocationMethod {
1968 m.DisableNotification = value
1969 return m
1970}
1971
1972// SetReplyToMessageID - If the message is a reply, ID of the original message
1973func (m *SendLocationMethod) SetReplyToMessageID(value int) *SendLocationMethod {
1974 m.ReplyToMessageID = value
1975 return m
1976}
1977
1978// 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.
1979func (m *SendLocationMethod) SetReplyMarkup(value *ReplyMarkup) *SendLocationMethod {
1980 m.ReplyMarkup = value
1981 return m
1982}
1983
1984// Send is used to send request using Telegram Bot Client
1985func (m *SendLocationMethod) Send(client Client) (res *Message, err error) {
1986 return res, client.Send("sendLocation", m, res)
1987}
1988
1989// EditMessageLiveLocationMethod represents Telegram Bot API method editMessageLiveLocation
1990// 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.
1991type EditMessageLiveLocationMethod struct {
1992 ChatID ChatID `json:"chat_id"`
1993 MessageID int `json:"message_id"`
1994 InlineMessageID string `json:"inline_message_id"`
1995 Latitude float64 `json:"latitude"`
1996 Longitude float64 `json:"longitude"`
1997 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
1998}
1999
2000// EditMessageLiveLocation creates new Telegram Bot API method editMessageLiveLocation
2001// 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.
2002func EditMessageLiveLocation(latitude float64, longitude float64) *EditMessageLiveLocationMethod {
2003 return &EditMessageLiveLocationMethod{
2004 Latitude: latitude,
2005 Longitude: longitude,
2006 }
2007}
2008
2009// 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)
2010func (m *EditMessageLiveLocationMethod) SetChatID(value ChatID) *EditMessageLiveLocationMethod {
2011 m.ChatID = value
2012 return m
2013}
2014
2015// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
2016func (m *EditMessageLiveLocationMethod) SetMessageID(value int) *EditMessageLiveLocationMethod {
2017 m.MessageID = value
2018 return m
2019}
2020
2021// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
2022func (m *EditMessageLiveLocationMethod) SetInlineMessageID(value string) *EditMessageLiveLocationMethod {
2023 m.InlineMessageID = value
2024 return m
2025}
2026
2027// SetLatitude - Latitude of new location
2028func (m *EditMessageLiveLocationMethod) SetLatitude(value float64) *EditMessageLiveLocationMethod {
2029 m.Latitude = value
2030 return m
2031}
2032
2033// SetLongitude - Longitude of new location
2034func (m *EditMessageLiveLocationMethod) SetLongitude(value float64) *EditMessageLiveLocationMethod {
2035 m.Longitude = value
2036 return m
2037}
2038
2039// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
2040func (m *EditMessageLiveLocationMethod) SetReplyMarkup(value *ReplyMarkup) *EditMessageLiveLocationMethod {
2041 m.ReplyMarkup = value
2042 return m
2043}
2044
2045// Send is used to send request using Telegram Bot Client
2046func (m *EditMessageLiveLocationMethod) Send(client Client) (res *Message, err error) {
2047 return res, client.Send("editMessageLiveLocation", m, res)
2048}
2049
2050// StopMessageLiveLocationMethod represents Telegram Bot API method stopMessageLiveLocation
2051// 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.
2052type StopMessageLiveLocationMethod struct {
2053 ChatID ChatID `json:"chat_id"`
2054 MessageID int `json:"message_id"`
2055 InlineMessageID string `json:"inline_message_id"`
2056 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
2057}
2058
2059// StopMessageLiveLocation creates new Telegram Bot API method stopMessageLiveLocation
2060// 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.
2061func StopMessageLiveLocation() *StopMessageLiveLocationMethod {
2062 return &StopMessageLiveLocationMethod{}
2063}
2064
2065// 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)
2066func (m *StopMessageLiveLocationMethod) SetChatID(value ChatID) *StopMessageLiveLocationMethod {
2067 m.ChatID = value
2068 return m
2069}
2070
2071// SetMessageID - Required if inline_message_id is not specified. Identifier of the message with live location to stop
2072func (m *StopMessageLiveLocationMethod) SetMessageID(value int) *StopMessageLiveLocationMethod {
2073 m.MessageID = value
2074 return m
2075}
2076
2077// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
2078func (m *StopMessageLiveLocationMethod) SetInlineMessageID(value string) *StopMessageLiveLocationMethod {
2079 m.InlineMessageID = value
2080 return m
2081}
2082
2083// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
2084func (m *StopMessageLiveLocationMethod) SetReplyMarkup(value *ReplyMarkup) *StopMessageLiveLocationMethod {
2085 m.ReplyMarkup = value
2086 return m
2087}
2088
2089// Send is used to send request using Telegram Bot Client
2090func (m *StopMessageLiveLocationMethod) Send(client Client) (res *Message, err error) {
2091 return res, client.Send("stopMessageLiveLocation", m, res)
2092}
2093
2094// SendVenueMethod represents Telegram Bot API method sendVenue
2095// Use this method to send information about a venue. On success, the sent Message is returned.
2096type SendVenueMethod struct {
2097 ChatID ChatID `json:"chat_id"`
2098 Latitude float64 `json:"latitude"`
2099 Longitude float64 `json:"longitude"`
2100 Title string `json:"title"`
2101 Address string `json:"address"`
2102 FoursquareID string `json:"foursquare_id"`
2103 FoursquareType string `json:"foursquare_type"`
2104 DisableNotification bool `json:"disable_notification"`
2105 ReplyToMessageID int `json:"reply_to_message_id"`
2106 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
2107}
2108
2109// SendVenue creates new Telegram Bot API method sendVenue
2110// Use this method to send information about a venue. On success, the sent Message is returned.
2111func SendVenue(chatID ChatID, latitude float64, longitude float64, title string, address string) *SendVenueMethod {
2112 return &SendVenueMethod{
2113 ChatID: chatID,
2114 Latitude: latitude,
2115 Longitude: longitude,
2116 Title: title,
2117 Address: address,
2118 }
2119}
2120
2121// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2122func (m *SendVenueMethod) SetChatID(value ChatID) *SendVenueMethod {
2123 m.ChatID = value
2124 return m
2125}
2126
2127// SetLatitude - Latitude of the venue
2128func (m *SendVenueMethod) SetLatitude(value float64) *SendVenueMethod {
2129 m.Latitude = value
2130 return m
2131}
2132
2133// SetLongitude - Longitude of the venue
2134func (m *SendVenueMethod) SetLongitude(value float64) *SendVenueMethod {
2135 m.Longitude = value
2136 return m
2137}
2138
2139// SetTitle - Name of the venue
2140func (m *SendVenueMethod) SetTitle(value string) *SendVenueMethod {
2141 m.Title = value
2142 return m
2143}
2144
2145// SetAddress - Address of the venue
2146func (m *SendVenueMethod) SetAddress(value string) *SendVenueMethod {
2147 m.Address = value
2148 return m
2149}
2150
2151// SetFoursquareID - Foursquare identifier of the venue
2152func (m *SendVenueMethod) SetFoursquareID(value string) *SendVenueMethod {
2153 m.FoursquareID = value
2154 return m
2155}
2156
2157// SetFoursquareType - Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2158func (m *SendVenueMethod) SetFoursquareType(value string) *SendVenueMethod {
2159 m.FoursquareType = value
2160 return m
2161}
2162
2163// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2164func (m *SendVenueMethod) SetDisableNotification(value bool) *SendVenueMethod {
2165 m.DisableNotification = value
2166 return m
2167}
2168
2169// SetReplyToMessageID - If the message is a reply, ID of the original message
2170func (m *SendVenueMethod) SetReplyToMessageID(value int) *SendVenueMethod {
2171 m.ReplyToMessageID = value
2172 return m
2173}
2174
2175// 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.
2176func (m *SendVenueMethod) SetReplyMarkup(value *ReplyMarkup) *SendVenueMethod {
2177 m.ReplyMarkup = value
2178 return m
2179}
2180
2181// Send is used to send request using Telegram Bot Client
2182func (m *SendVenueMethod) Send(client Client) (res *Message, err error) {
2183 return res, client.Send("sendVenue", m, res)
2184}
2185
2186// SendContactMethod represents Telegram Bot API method sendContact
2187// Use this method to send phone contacts. On success, the sent Message is returned.
2188type SendContactMethod struct {
2189 ChatID ChatID `json:"chat_id"`
2190 PhoneNumber string `json:"phone_number"`
2191 FirstName string `json:"first_name"`
2192 LastName string `json:"last_name"`
2193 Vcard string `json:"vcard"`
2194 DisableNotification bool `json:"disable_notification"`
2195 ReplyToMessageID int `json:"reply_to_message_id"`
2196 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
2197}
2198
2199// SendContact creates new Telegram Bot API method sendContact
2200// Use this method to send phone contacts. On success, the sent Message is returned.
2201func SendContact(chatID ChatID, phoneNumber string, firstName string) *SendContactMethod {
2202 return &SendContactMethod{
2203 ChatID: chatID,
2204 PhoneNumber: phoneNumber,
2205 FirstName: firstName,
2206 }
2207}
2208
2209// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2210func (m *SendContactMethod) SetChatID(value ChatID) *SendContactMethod {
2211 m.ChatID = value
2212 return m
2213}
2214
2215// SetPhoneNumber - Contact's phone number
2216func (m *SendContactMethod) SetPhoneNumber(value string) *SendContactMethod {
2217 m.PhoneNumber = value
2218 return m
2219}
2220
2221// SetFirstName - Contact's first name
2222func (m *SendContactMethod) SetFirstName(value string) *SendContactMethod {
2223 m.FirstName = value
2224 return m
2225}
2226
2227// SetLastName - Contact's last name
2228func (m *SendContactMethod) SetLastName(value string) *SendContactMethod {
2229 m.LastName = value
2230 return m
2231}
2232
2233// SetVcard - Additional data about the contact in the form of a vCard, 0-2048 bytes
2234func (m *SendContactMethod) SetVcard(value string) *SendContactMethod {
2235 m.Vcard = value
2236 return m
2237}
2238
2239// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2240func (m *SendContactMethod) SetDisableNotification(value bool) *SendContactMethod {
2241 m.DisableNotification = value
2242 return m
2243}
2244
2245// SetReplyToMessageID - If the message is a reply, ID of the original message
2246func (m *SendContactMethod) SetReplyToMessageID(value int) *SendContactMethod {
2247 m.ReplyToMessageID = value
2248 return m
2249}
2250
2251// 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.
2252func (m *SendContactMethod) SetReplyMarkup(value *ReplyMarkup) *SendContactMethod {
2253 m.ReplyMarkup = value
2254 return m
2255}
2256
2257// Send is used to send request using Telegram Bot Client
2258func (m *SendContactMethod) Send(client Client) (res *Message, err error) {
2259 return res, client.Send("sendContact", m, res)
2260}
2261
2262// SendPollMethod represents Telegram Bot API method sendPoll
2263// Use this method to send a native poll. On success, the sent Message is returned.
2264type SendPollMethod struct {
2265 ChatID ChatID `json:"chat_id"`
2266 Question string `json:"question"`
2267 Options []string `json:"options"`
2268 IsAnonymous bool `json:"is_anonymous"`
2269 Type string `json:"type"`
2270 AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
2271 CorrectOptionID int `json:"correct_option_id"`
2272 IsClosed bool `json:"is_closed"`
2273 DisableNotification bool `json:"disable_notification"`
2274 ReplyToMessageID int `json:"reply_to_message_id"`
2275 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
2276}
2277
2278// SendPoll creates new Telegram Bot API method sendPoll
2279// Use this method to send a native poll. On success, the sent Message is returned.
2280func SendPoll(chatID ChatID, question string, options []string) *SendPollMethod {
2281 return &SendPollMethod{
2282 ChatID: chatID,
2283 Question: question,
2284 Options: options,
2285 }
2286}
2287
2288// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2289func (m *SendPollMethod) SetChatID(value ChatID) *SendPollMethod {
2290 m.ChatID = value
2291 return m
2292}
2293
2294// SetQuestion - Poll question, 1-255 characters
2295func (m *SendPollMethod) SetQuestion(value string) *SendPollMethod {
2296 m.Question = value
2297 return m
2298}
2299
2300// SetOptions - A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
2301func (m *SendPollMethod) SetOptions(value []string) *SendPollMethod {
2302 m.Options = value
2303 return m
2304}
2305
2306// SetIsAnonymous - True, if the poll needs to be anonymous, defaults to True
2307func (m *SendPollMethod) SetIsAnonymous(value bool) *SendPollMethod {
2308 m.IsAnonymous = value
2309 return m
2310}
2311
2312// SetType - Poll type, “quiz” or “regular”, defaults to “regular”
2313func (m *SendPollMethod) SetType(value string) *SendPollMethod {
2314 m.Type = value
2315 return m
2316}
2317
2318// SetAllowsMultipleAnswers - True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
2319func (m *SendPollMethod) SetAllowsMultipleAnswers(value bool) *SendPollMethod {
2320 m.AllowsMultipleAnswers = value
2321 return m
2322}
2323
2324// SetCorrectOptionID - 0-based identifier of the correct answer option, required for polls in quiz mode
2325func (m *SendPollMethod) SetCorrectOptionID(value int) *SendPollMethod {
2326 m.CorrectOptionID = value
2327 return m
2328}
2329
2330// SetIsClosed - Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
2331func (m *SendPollMethod) SetIsClosed(value bool) *SendPollMethod {
2332 m.IsClosed = value
2333 return m
2334}
2335
2336// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
2337func (m *SendPollMethod) SetDisableNotification(value bool) *SendPollMethod {
2338 m.DisableNotification = value
2339 return m
2340}
2341
2342// SetReplyToMessageID - If the message is a reply, ID of the original message
2343func (m *SendPollMethod) SetReplyToMessageID(value int) *SendPollMethod {
2344 m.ReplyToMessageID = value
2345 return m
2346}
2347
2348// 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.
2349func (m *SendPollMethod) SetReplyMarkup(value *ReplyMarkup) *SendPollMethod {
2350 m.ReplyMarkup = value
2351 return m
2352}
2353
2354// Send is used to send request using Telegram Bot Client
2355func (m *SendPollMethod) Send(client Client) (res *Message, err error) {
2356 return res, client.Send("sendPoll", m, res)
2357}
2358
2359// SendChatActionMethod represents Telegram Bot API method sendChatAction
2360// 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.
2361type SendChatActionMethod struct {
2362 ChatID ChatID `json:"chat_id"`
2363 Action string `json:"action"`
2364}
2365
2366// SendChatAction creates new Telegram Bot API method sendChatAction
2367// 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.
2368func SendChatAction(chatID ChatID, action string) *SendChatActionMethod {
2369 return &SendChatActionMethod{
2370 ChatID: chatID,
2371 Action: action,
2372 }
2373}
2374
2375// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2376func (m *SendChatActionMethod) SetChatID(value ChatID) *SendChatActionMethod {
2377 m.ChatID = value
2378 return m
2379}
2380
2381// 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.
2382func (m *SendChatActionMethod) SetAction(value string) *SendChatActionMethod {
2383 m.Action = value
2384 return m
2385}
2386
2387// Send is used to send request using Telegram Bot Client
2388func (m *SendChatActionMethod) Send(client Client) (res *bool, err error) {
2389 return res, client.Send("sendChatAction", m, res)
2390}
2391
2392// GetUserProfilePhotosMethod represents Telegram Bot API method getUserProfilePhotos
2393// Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
2394type GetUserProfilePhotosMethod struct {
2395 UserID int `json:"user_id"`
2396 Offset int `json:"offset"`
2397 Limit int `json:"limit"`
2398}
2399
2400// GetUserProfilePhotos creates new Telegram Bot API method getUserProfilePhotos
2401// Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
2402func GetUserProfilePhotos(userID int) *GetUserProfilePhotosMethod {
2403 return &GetUserProfilePhotosMethod{
2404 UserID: userID,
2405 }
2406}
2407
2408// SetUserID - Unique identifier of the target user
2409func (m *GetUserProfilePhotosMethod) SetUserID(value int) *GetUserProfilePhotosMethod {
2410 m.UserID = value
2411 return m
2412}
2413
2414// SetOffset - Sequential number of the first photo to be returned. By default, all photos are returned.
2415func (m *GetUserProfilePhotosMethod) SetOffset(value int) *GetUserProfilePhotosMethod {
2416 m.Offset = value
2417 return m
2418}
2419
2420// SetLimit - Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
2421func (m *GetUserProfilePhotosMethod) SetLimit(value int) *GetUserProfilePhotosMethod {
2422 m.Limit = value
2423 return m
2424}
2425
2426// Send is used to send request using Telegram Bot Client
2427func (m *GetUserProfilePhotosMethod) Send(client Client) (res *UserProfilePhotos, err error) {
2428 return res, client.Send("getUserProfilePhotos", m, res)
2429}
2430
2431// GetFileMethod represents Telegram Bot API method getFile
2432// 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.
2433type GetFileMethod struct {
2434 FileID string `json:"file_id"`
2435}
2436
2437// GetFile creates new Telegram Bot API method getFile
2438// 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.
2439func GetFile(fileID string) *GetFileMethod {
2440 return &GetFileMethod{
2441 FileID: fileID,
2442 }
2443}
2444
2445// SetFileID - File identifier to get info about
2446func (m *GetFileMethod) SetFileID(value string) *GetFileMethod {
2447 m.FileID = value
2448 return m
2449}
2450
2451// Send is used to send request using Telegram Bot Client
2452func (m *GetFileMethod) Send(client Client) (res *File, err error) {
2453 return res, client.Send("getFile", m, res)
2454}
2455
2456// KickChatMemberMethod represents Telegram Bot API method kickChatMember
2457// 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.
2458type KickChatMemberMethod struct {
2459 ChatID ChatID `json:"chat_id"`
2460 UserID int `json:"user_id"`
2461 UntilDate int `json:"until_date"`
2462}
2463
2464// KickChatMember creates new Telegram Bot API method kickChatMember
2465// 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.
2466func KickChatMember(chatID ChatID, userID int) *KickChatMemberMethod {
2467 return &KickChatMemberMethod{
2468 ChatID: chatID,
2469 UserID: userID,
2470 }
2471}
2472
2473// SetChatID - Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
2474func (m *KickChatMemberMethod) SetChatID(value ChatID) *KickChatMemberMethod {
2475 m.ChatID = value
2476 return m
2477}
2478
2479// SetUserID - Unique identifier of the target user
2480func (m *KickChatMemberMethod) SetUserID(value int) *KickChatMemberMethod {
2481 m.UserID = value
2482 return m
2483}
2484
2485// 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
2486func (m *KickChatMemberMethod) SetUntilDate(value int) *KickChatMemberMethod {
2487 m.UntilDate = value
2488 return m
2489}
2490
2491// Send is used to send request using Telegram Bot Client
2492func (m *KickChatMemberMethod) Send(client Client) (res *bool, err error) {
2493 return res, client.Send("kickChatMember", m, res)
2494}
2495
2496// UnbanChatMemberMethod represents Telegram Bot API method unbanChatMember
2497// 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.
2498type UnbanChatMemberMethod struct {
2499 ChatID ChatID `json:"chat_id"`
2500 UserID int `json:"user_id"`
2501}
2502
2503// UnbanChatMember creates new Telegram Bot API method unbanChatMember
2504// 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.
2505func UnbanChatMember(chatID ChatID, userID int) *UnbanChatMemberMethod {
2506 return &UnbanChatMemberMethod{
2507 ChatID: chatID,
2508 UserID: userID,
2509 }
2510}
2511
2512// SetChatID - Unique identifier for the target group or username of the target supergroup or channel (in the format @username)
2513func (m *UnbanChatMemberMethod) SetChatID(value ChatID) *UnbanChatMemberMethod {
2514 m.ChatID = value
2515 return m
2516}
2517
2518// SetUserID - Unique identifier of the target user
2519func (m *UnbanChatMemberMethod) SetUserID(value int) *UnbanChatMemberMethod {
2520 m.UserID = value
2521 return m
2522}
2523
2524// Send is used to send request using Telegram Bot Client
2525func (m *UnbanChatMemberMethod) Send(client Client) (res *bool, err error) {
2526 return res, client.Send("unbanChatMember", m, res)
2527}
2528
2529// RestrictChatMemberMethod represents Telegram Bot API method restrictChatMember
2530// 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.
2531type RestrictChatMemberMethod struct {
2532 ChatID ChatID `json:"chat_id"`
2533 UserID int `json:"user_id"`
2534 Permissions *ChatPermissions `json:"permissions"`
2535 UntilDate int `json:"until_date"`
2536}
2537
2538// RestrictChatMember creates new Telegram Bot API method restrictChatMember
2539// 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.
2540func RestrictChatMember(chatID ChatID, userID int, permissions *ChatPermissions) *RestrictChatMemberMethod {
2541 return &RestrictChatMemberMethod{
2542 ChatID: chatID,
2543 UserID: userID,
2544 Permissions: permissions,
2545 }
2546}
2547
2548// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2549func (m *RestrictChatMemberMethod) SetChatID(value ChatID) *RestrictChatMemberMethod {
2550 m.ChatID = value
2551 return m
2552}
2553
2554// SetUserID - Unique identifier of the target user
2555func (m *RestrictChatMemberMethod) SetUserID(value int) *RestrictChatMemberMethod {
2556 m.UserID = value
2557 return m
2558}
2559
2560// SetPermissions - New user permissions
2561func (m *RestrictChatMemberMethod) SetPermissions(value *ChatPermissions) *RestrictChatMemberMethod {
2562 m.Permissions = value
2563 return m
2564}
2565
2566// 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
2567func (m *RestrictChatMemberMethod) SetUntilDate(value int) *RestrictChatMemberMethod {
2568 m.UntilDate = value
2569 return m
2570}
2571
2572// Send is used to send request using Telegram Bot Client
2573func (m *RestrictChatMemberMethod) Send(client Client) (res *bool, err error) {
2574 return res, client.Send("restrictChatMember", m, res)
2575}
2576
2577// PromoteChatMemberMethod represents Telegram Bot API method promoteChatMember
2578// 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.
2579type PromoteChatMemberMethod struct {
2580 ChatID ChatID `json:"chat_id"`
2581 UserID int `json:"user_id"`
2582 CanChangeInfo bool `json:"can_change_info"`
2583 CanPostMessages bool `json:"can_post_messages"`
2584 CanEditMessages bool `json:"can_edit_messages"`
2585 CanDeleteMessages bool `json:"can_delete_messages"`
2586 CanInviteUsers bool `json:"can_invite_users"`
2587 CanRestrictMembers bool `json:"can_restrict_members"`
2588 CanPinMessages bool `json:"can_pin_messages"`
2589 CanPromoteMembers bool `json:"can_promote_members"`
2590}
2591
2592// PromoteChatMember creates new Telegram Bot API method promoteChatMember
2593// 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.
2594func PromoteChatMember(chatID ChatID, userID int) *PromoteChatMemberMethod {
2595 return &PromoteChatMemberMethod{
2596 ChatID: chatID,
2597 UserID: userID,
2598 }
2599}
2600
2601// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2602func (m *PromoteChatMemberMethod) SetChatID(value ChatID) *PromoteChatMemberMethod {
2603 m.ChatID = value
2604 return m
2605}
2606
2607// SetUserID - Unique identifier of the target user
2608func (m *PromoteChatMemberMethod) SetUserID(value int) *PromoteChatMemberMethod {
2609 m.UserID = value
2610 return m
2611}
2612
2613// SetCanChangeInfo - Pass True, if the administrator can change chat title, photo and other settings
2614func (m *PromoteChatMemberMethod) SetCanChangeInfo(value bool) *PromoteChatMemberMethod {
2615 m.CanChangeInfo = value
2616 return m
2617}
2618
2619// SetCanPostMessages - Pass True, if the administrator can create channel posts, channels only
2620func (m *PromoteChatMemberMethod) SetCanPostMessages(value bool) *PromoteChatMemberMethod {
2621 m.CanPostMessages = value
2622 return m
2623}
2624
2625// SetCanEditMessages - Pass True, if the administrator can edit messages of other users and can pin messages, channels only
2626func (m *PromoteChatMemberMethod) SetCanEditMessages(value bool) *PromoteChatMemberMethod {
2627 m.CanEditMessages = value
2628 return m
2629}
2630
2631// SetCanDeleteMessages - Pass True, if the administrator can delete messages of other users
2632func (m *PromoteChatMemberMethod) SetCanDeleteMessages(value bool) *PromoteChatMemberMethod {
2633 m.CanDeleteMessages = value
2634 return m
2635}
2636
2637// SetCanInviteUsers - Pass True, if the administrator can invite new users to the chat
2638func (m *PromoteChatMemberMethod) SetCanInviteUsers(value bool) *PromoteChatMemberMethod {
2639 m.CanInviteUsers = value
2640 return m
2641}
2642
2643// SetCanRestrictMembers - Pass True, if the administrator can restrict, ban or unban chat members
2644func (m *PromoteChatMemberMethod) SetCanRestrictMembers(value bool) *PromoteChatMemberMethod {
2645 m.CanRestrictMembers = value
2646 return m
2647}
2648
2649// SetCanPinMessages - Pass True, if the administrator can pin messages, supergroups only
2650func (m *PromoteChatMemberMethod) SetCanPinMessages(value bool) *PromoteChatMemberMethod {
2651 m.CanPinMessages = value
2652 return m
2653}
2654
2655// 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)
2656func (m *PromoteChatMemberMethod) SetCanPromoteMembers(value bool) *PromoteChatMemberMethod {
2657 m.CanPromoteMembers = value
2658 return m
2659}
2660
2661// Send is used to send request using Telegram Bot Client
2662func (m *PromoteChatMemberMethod) Send(client Client) (res *bool, err error) {
2663 return res, client.Send("promoteChatMember", m, res)
2664}
2665
2666// SetChatAdministratorCustomTitleMethod represents Telegram Bot API method setChatAdministratorCustomTitle
2667// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
2668type SetChatAdministratorCustomTitleMethod struct {
2669 ChatID ChatID `json:"chat_id"`
2670 UserID int `json:"user_id"`
2671 CustomTitle string `json:"custom_title"`
2672}
2673
2674// SetChatAdministratorCustomTitle creates new Telegram Bot API method setChatAdministratorCustomTitle
2675// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
2676func SetChatAdministratorCustomTitle(chatID ChatID, userID int, customTitle string) *SetChatAdministratorCustomTitleMethod {
2677 return &SetChatAdministratorCustomTitleMethod{
2678 ChatID: chatID,
2679 UserID: userID,
2680 CustomTitle: customTitle,
2681 }
2682}
2683
2684// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2685func (m *SetChatAdministratorCustomTitleMethod) SetChatID(value ChatID) *SetChatAdministratorCustomTitleMethod {
2686 m.ChatID = value
2687 return m
2688}
2689
2690// SetUserID - Unique identifier of the target user
2691func (m *SetChatAdministratorCustomTitleMethod) SetUserID(value int) *SetChatAdministratorCustomTitleMethod {
2692 m.UserID = value
2693 return m
2694}
2695
2696// SetCustomTitle - New custom title for the administrator; 0-16 characters, emoji are not allowed
2697func (m *SetChatAdministratorCustomTitleMethod) SetCustomTitle(value string) *SetChatAdministratorCustomTitleMethod {
2698 m.CustomTitle = value
2699 return m
2700}
2701
2702// Send is used to send request using Telegram Bot Client
2703func (m *SetChatAdministratorCustomTitleMethod) Send(client Client) (res *bool, err error) {
2704 return res, client.Send("setChatAdministratorCustomTitle", m, res)
2705}
2706
2707// SetChatPermissionsMethod represents Telegram Bot API method setChatPermissions
2708// 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.
2709type SetChatPermissionsMethod struct {
2710 ChatID ChatID `json:"chat_id"`
2711 Permissions *ChatPermissions `json:"permissions"`
2712}
2713
2714// SetChatPermissions creates new Telegram Bot API method setChatPermissions
2715// 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.
2716func SetChatPermissions(chatID ChatID, permissions *ChatPermissions) *SetChatPermissionsMethod {
2717 return &SetChatPermissionsMethod{
2718 ChatID: chatID,
2719 Permissions: permissions,
2720 }
2721}
2722
2723// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
2724func (m *SetChatPermissionsMethod) SetChatID(value ChatID) *SetChatPermissionsMethod {
2725 m.ChatID = value
2726 return m
2727}
2728
2729// SetPermissions - New default chat permissions
2730func (m *SetChatPermissionsMethod) SetPermissions(value *ChatPermissions) *SetChatPermissionsMethod {
2731 m.Permissions = value
2732 return m
2733}
2734
2735// Send is used to send request using Telegram Bot Client
2736func (m *SetChatPermissionsMethod) Send(client Client) (res *bool, err error) {
2737 return res, client.Send("setChatPermissions", m, res)
2738}
2739
2740// ExportChatInviteLinkMethod represents Telegram Bot API method exportChatInviteLink
2741// 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.
2742type ExportChatInviteLinkMethod struct {
2743 ChatID ChatID `json:"chat_id"`
2744}
2745
2746// ExportChatInviteLink creates new Telegram Bot API method exportChatInviteLink
2747// 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.
2748func ExportChatInviteLink(chatID ChatID) *ExportChatInviteLinkMethod {
2749 return &ExportChatInviteLinkMethod{
2750 ChatID: chatID,
2751 }
2752}
2753
2754// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2755func (m *ExportChatInviteLinkMethod) SetChatID(value ChatID) *ExportChatInviteLinkMethod {
2756 m.ChatID = value
2757 return m
2758}
2759
2760// Send is used to send request using Telegram Bot Client
2761func (m *ExportChatInviteLinkMethod) Send(client Client) (res *string, err error) {
2762 return res, client.Send("exportChatInviteLink", m, res)
2763}
2764
2765// SetChatPhotoMethod represents Telegram Bot API method setChatPhoto
2766// 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.
2767type SetChatPhotoMethod struct {
2768 ChatID ChatID `json:"chat_id"`
2769 Photo *InputFile `json:"photo"`
2770}
2771
2772// SetChatPhoto creates new Telegram Bot API method setChatPhoto
2773// 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.
2774func SetChatPhoto(chatID ChatID, photo *InputFile) *SetChatPhotoMethod {
2775 return &SetChatPhotoMethod{
2776 ChatID: chatID,
2777 Photo: photo,
2778 }
2779}
2780
2781// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2782func (m *SetChatPhotoMethod) SetChatID(value ChatID) *SetChatPhotoMethod {
2783 m.ChatID = value
2784 return m
2785}
2786
2787// SetPhoto - New chat photo, uploaded using multipart/form-data
2788func (m *SetChatPhotoMethod) SetPhoto(value *InputFile) *SetChatPhotoMethod {
2789 m.Photo = value
2790 return m
2791}
2792
2793// Send is used to send request using Telegram Bot Client
2794func (m *SetChatPhotoMethod) Send(client Client) (res *bool, err error) {
2795 return res, client.Send("setChatPhoto", m, res)
2796}
2797
2798// DeleteChatPhotoMethod represents Telegram Bot API method deleteChatPhoto
2799// 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.
2800type DeleteChatPhotoMethod struct {
2801 ChatID ChatID `json:"chat_id"`
2802}
2803
2804// DeleteChatPhoto creates new Telegram Bot API method deleteChatPhoto
2805// 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.
2806func DeleteChatPhoto(chatID ChatID) *DeleteChatPhotoMethod {
2807 return &DeleteChatPhotoMethod{
2808 ChatID: chatID,
2809 }
2810}
2811
2812// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2813func (m *DeleteChatPhotoMethod) SetChatID(value ChatID) *DeleteChatPhotoMethod {
2814 m.ChatID = value
2815 return m
2816}
2817
2818// Send is used to send request using Telegram Bot Client
2819func (m *DeleteChatPhotoMethod) Send(client Client) (res *bool, err error) {
2820 return res, client.Send("deleteChatPhoto", m, res)
2821}
2822
2823// SetChatTitleMethod represents Telegram Bot API method setChatTitle
2824// 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.
2825type SetChatTitleMethod struct {
2826 ChatID ChatID `json:"chat_id"`
2827 Title string `json:"title"`
2828}
2829
2830// SetChatTitle creates new Telegram Bot API method setChatTitle
2831// 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.
2832func SetChatTitle(chatID ChatID, title string) *SetChatTitleMethod {
2833 return &SetChatTitleMethod{
2834 ChatID: chatID,
2835 Title: title,
2836 }
2837}
2838
2839// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2840func (m *SetChatTitleMethod) SetChatID(value ChatID) *SetChatTitleMethod {
2841 m.ChatID = value
2842 return m
2843}
2844
2845// SetTitle - New chat title, 1-255 characters
2846func (m *SetChatTitleMethod) SetTitle(value string) *SetChatTitleMethod {
2847 m.Title = value
2848 return m
2849}
2850
2851// Send is used to send request using Telegram Bot Client
2852func (m *SetChatTitleMethod) Send(client Client) (res *bool, err error) {
2853 return res, client.Send("setChatTitle", m, res)
2854}
2855
2856// SetChatDescriptionMethod represents Telegram Bot API method setChatDescription
2857// 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.
2858type SetChatDescriptionMethod struct {
2859 ChatID ChatID `json:"chat_id"`
2860 Description string `json:"description"`
2861}
2862
2863// SetChatDescription creates new Telegram Bot API method setChatDescription
2864// 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.
2865func SetChatDescription(chatID ChatID) *SetChatDescriptionMethod {
2866 return &SetChatDescriptionMethod{
2867 ChatID: chatID,
2868 }
2869}
2870
2871// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2872func (m *SetChatDescriptionMethod) SetChatID(value ChatID) *SetChatDescriptionMethod {
2873 m.ChatID = value
2874 return m
2875}
2876
2877// SetDescription - New chat description, 0-255 characters
2878func (m *SetChatDescriptionMethod) SetDescription(value string) *SetChatDescriptionMethod {
2879 m.Description = value
2880 return m
2881}
2882
2883// Send is used to send request using Telegram Bot Client
2884func (m *SetChatDescriptionMethod) Send(client Client) (res *bool, err error) {
2885 return res, client.Send("setChatDescription", m, res)
2886}
2887
2888// PinChatMessageMethod represents Telegram Bot API method pinChatMessage
2889// 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.
2890type PinChatMessageMethod struct {
2891 ChatID ChatID `json:"chat_id"`
2892 MessageID int `json:"message_id"`
2893 DisableNotification bool `json:"disable_notification"`
2894}
2895
2896// PinChatMessage creates new Telegram Bot API method pinChatMessage
2897// 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.
2898func PinChatMessage(chatID ChatID, messageID int) *PinChatMessageMethod {
2899 return &PinChatMessageMethod{
2900 ChatID: chatID,
2901 MessageID: messageID,
2902 }
2903}
2904
2905// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2906func (m *PinChatMessageMethod) SetChatID(value ChatID) *PinChatMessageMethod {
2907 m.ChatID = value
2908 return m
2909}
2910
2911// SetMessageID - Identifier of a message to pin
2912func (m *PinChatMessageMethod) SetMessageID(value int) *PinChatMessageMethod {
2913 m.MessageID = value
2914 return m
2915}
2916
2917// 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.
2918func (m *PinChatMessageMethod) SetDisableNotification(value bool) *PinChatMessageMethod {
2919 m.DisableNotification = value
2920 return m
2921}
2922
2923// Send is used to send request using Telegram Bot Client
2924func (m *PinChatMessageMethod) Send(client Client) (res *bool, err error) {
2925 return res, client.Send("pinChatMessage", m, res)
2926}
2927
2928// UnpinChatMessageMethod represents Telegram Bot API method unpinChatMessage
2929// 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.
2930type UnpinChatMessageMethod struct {
2931 ChatID ChatID `json:"chat_id"`
2932}
2933
2934// UnpinChatMessage creates new Telegram Bot API method unpinChatMessage
2935// 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.
2936func UnpinChatMessage(chatID ChatID) *UnpinChatMessageMethod {
2937 return &UnpinChatMessageMethod{
2938 ChatID: chatID,
2939 }
2940}
2941
2942// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2943func (m *UnpinChatMessageMethod) SetChatID(value ChatID) *UnpinChatMessageMethod {
2944 m.ChatID = value
2945 return m
2946}
2947
2948// Send is used to send request using Telegram Bot Client
2949func (m *UnpinChatMessageMethod) Send(client Client) (res *bool, err error) {
2950 return res, client.Send("unpinChatMessage", m, res)
2951}
2952
2953// LeaveChatMethod represents Telegram Bot API method leaveChat
2954// Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
2955type LeaveChatMethod struct {
2956 ChatID ChatID `json:"chat_id"`
2957}
2958
2959// LeaveChat creates new Telegram Bot API method leaveChat
2960// Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
2961func LeaveChat(chatID ChatID) *LeaveChatMethod {
2962 return &LeaveChatMethod{
2963 ChatID: chatID,
2964 }
2965}
2966
2967// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
2968func (m *LeaveChatMethod) SetChatID(value ChatID) *LeaveChatMethod {
2969 m.ChatID = value
2970 return m
2971}
2972
2973// Send is used to send request using Telegram Bot Client
2974func (m *LeaveChatMethod) Send(client Client) (res *bool, err error) {
2975 return res, client.Send("leaveChat", m, res)
2976}
2977
2978// GetChatMethod represents Telegram Bot API method getChat
2979// 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.
2980type GetChatMethod struct {
2981 ChatID ChatID `json:"chat_id"`
2982}
2983
2984// GetChat creates new Telegram Bot API method getChat
2985// 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.
2986func GetChat(chatID ChatID) *GetChatMethod {
2987 return &GetChatMethod{
2988 ChatID: chatID,
2989 }
2990}
2991
2992// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
2993func (m *GetChatMethod) SetChatID(value ChatID) *GetChatMethod {
2994 m.ChatID = value
2995 return m
2996}
2997
2998// Send is used to send request using Telegram Bot Client
2999func (m *GetChatMethod) Send(client Client) (res *Chat, err error) {
3000 return res, client.Send("getChat", m, res)
3001}
3002
3003// GetChatAdministratorsMethod represents Telegram Bot API method getChatAdministrators
3004// 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.
3005type GetChatAdministratorsMethod struct {
3006 ChatID ChatID `json:"chat_id"`
3007}
3008
3009// GetChatAdministrators creates new Telegram Bot API method getChatAdministrators
3010// 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.
3011func GetChatAdministrators(chatID ChatID) *GetChatAdministratorsMethod {
3012 return &GetChatAdministratorsMethod{
3013 ChatID: chatID,
3014 }
3015}
3016
3017// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3018func (m *GetChatAdministratorsMethod) SetChatID(value ChatID) *GetChatAdministratorsMethod {
3019 m.ChatID = value
3020 return m
3021}
3022
3023// Send is used to send request using Telegram Bot Client
3024func (m *GetChatAdministratorsMethod) Send(client Client) (res []*ChatMember, err error) {
3025 return res, client.Send("getChatAdministrators", m, res)
3026}
3027
3028// GetChatMembersCountMethod represents Telegram Bot API method getChatMembersCount
3029// Use this method to get the number of members in a chat. Returns Int on success.
3030type GetChatMembersCountMethod struct {
3031 ChatID ChatID `json:"chat_id"`
3032}
3033
3034// GetChatMembersCount creates new Telegram Bot API method getChatMembersCount
3035// Use this method to get the number of members in a chat. Returns Int on success.
3036func GetChatMembersCount(chatID ChatID) *GetChatMembersCountMethod {
3037 return &GetChatMembersCountMethod{
3038 ChatID: chatID,
3039 }
3040}
3041
3042// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3043func (m *GetChatMembersCountMethod) SetChatID(value ChatID) *GetChatMembersCountMethod {
3044 m.ChatID = value
3045 return m
3046}
3047
3048// Send is used to send request using Telegram Bot Client
3049func (m *GetChatMembersCountMethod) Send(client Client) (res *int, err error) {
3050 return res, client.Send("getChatMembersCount", m, res)
3051}
3052
3053// GetChatMemberMethod represents Telegram Bot API method getChatMember
3054// Use this method to get information about a member of a chat. Returns a ChatMember object on success.
3055type GetChatMemberMethod struct {
3056 ChatID ChatID `json:"chat_id"`
3057 UserID int `json:"user_id"`
3058}
3059
3060// GetChatMember creates new Telegram Bot API method getChatMember
3061// Use this method to get information about a member of a chat. Returns a ChatMember object on success.
3062func GetChatMember(chatID ChatID, userID int) *GetChatMemberMethod {
3063 return &GetChatMemberMethod{
3064 ChatID: chatID,
3065 UserID: userID,
3066 }
3067}
3068
3069// SetChatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
3070func (m *GetChatMemberMethod) SetChatID(value ChatID) *GetChatMemberMethod {
3071 m.ChatID = value
3072 return m
3073}
3074
3075// SetUserID - Unique identifier of the target user
3076func (m *GetChatMemberMethod) SetUserID(value int) *GetChatMemberMethod {
3077 m.UserID = value
3078 return m
3079}
3080
3081// Send is used to send request using Telegram Bot Client
3082func (m *GetChatMemberMethod) Send(client Client) (res *ChatMember, err error) {
3083 return res, client.Send("getChatMember", m, res)
3084}
3085
3086// SetChatStickerSetMethod represents Telegram Bot API method setChatStickerSet
3087// 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.
3088type SetChatStickerSetMethod struct {
3089 ChatID ChatID `json:"chat_id"`
3090 StickerSetName string `json:"sticker_set_name"`
3091}
3092
3093// SetChatStickerSet creates new Telegram Bot API method setChatStickerSet
3094// 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.
3095func SetChatStickerSet(chatID ChatID, stickerSetName string) *SetChatStickerSetMethod {
3096 return &SetChatStickerSetMethod{
3097 ChatID: chatID,
3098 StickerSetName: stickerSetName,
3099 }
3100}
3101
3102// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
3103func (m *SetChatStickerSetMethod) SetChatID(value ChatID) *SetChatStickerSetMethod {
3104 m.ChatID = value
3105 return m
3106}
3107
3108// SetStickerSetName - Name of the sticker set to be set as the group sticker set
3109func (m *SetChatStickerSetMethod) SetStickerSetName(value string) *SetChatStickerSetMethod {
3110 m.StickerSetName = value
3111 return m
3112}
3113
3114// Send is used to send request using Telegram Bot Client
3115func (m *SetChatStickerSetMethod) Send(client Client) (res *bool, err error) {
3116 return res, client.Send("setChatStickerSet", m, res)
3117}
3118
3119// DeleteChatStickerSetMethod represents Telegram Bot API method deleteChatStickerSet
3120// 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.
3121type DeleteChatStickerSetMethod struct {
3122 ChatID ChatID `json:"chat_id"`
3123}
3124
3125// DeleteChatStickerSet creates new Telegram Bot API method deleteChatStickerSet
3126// 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.
3127func DeleteChatStickerSet(chatID ChatID) *DeleteChatStickerSetMethod {
3128 return &DeleteChatStickerSetMethod{
3129 ChatID: chatID,
3130 }
3131}
3132
3133// SetChatID - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
3134func (m *DeleteChatStickerSetMethod) SetChatID(value ChatID) *DeleteChatStickerSetMethod {
3135 m.ChatID = value
3136 return m
3137}
3138
3139// Send is used to send request using Telegram Bot Client
3140func (m *DeleteChatStickerSetMethod) Send(client Client) (res *bool, err error) {
3141 return res, client.Send("deleteChatStickerSet", m, res)
3142}
3143
3144// AnswerCallbackQueryMethod represents Telegram Bot API method answerCallbackQuery
3145// 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.
3146type AnswerCallbackQueryMethod struct {
3147 CallbackQueryID string `json:"callback_query_id"`
3148 Text string `json:"text"`
3149 ShowAlert bool `json:"show_alert"`
3150 URL string `json:"url"`
3151 CacheTime int `json:"cache_time"`
3152}
3153
3154// AnswerCallbackQuery creates new Telegram Bot API method answerCallbackQuery
3155// 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.
3156func AnswerCallbackQuery(callbackQueryID string) *AnswerCallbackQueryMethod {
3157 return &AnswerCallbackQueryMethod{
3158 CallbackQueryID: callbackQueryID,
3159 }
3160}
3161
3162// SetCallbackQueryID - Unique identifier for the query to be answered
3163func (m *AnswerCallbackQueryMethod) SetCallbackQueryID(value string) *AnswerCallbackQueryMethod {
3164 m.CallbackQueryID = value
3165 return m
3166}
3167
3168// SetText - Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
3169func (m *AnswerCallbackQueryMethod) SetText(value string) *AnswerCallbackQueryMethod {
3170 m.Text = value
3171 return m
3172}
3173
3174// 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.
3175func (m *AnswerCallbackQueryMethod) SetShowAlert(value bool) *AnswerCallbackQueryMethod {
3176 m.ShowAlert = value
3177 return m
3178}
3179
3180// 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.
3181func (m *AnswerCallbackQueryMethod) SetURL(value string) *AnswerCallbackQueryMethod {
3182 m.URL = value
3183 return m
3184}
3185
3186// 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.
3187func (m *AnswerCallbackQueryMethod) SetCacheTime(value int) *AnswerCallbackQueryMethod {
3188 m.CacheTime = value
3189 return m
3190}
3191
3192// Send is used to send request using Telegram Bot Client
3193func (m *AnswerCallbackQueryMethod) Send(client Client) (res *bool, err error) {
3194 return res, client.Send("answerCallbackQuery", m, res)
3195}
3196
3197// EditMessageTextMethod represents Telegram Bot API method editMessageText
3198// 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.
3199type EditMessageTextMethod struct {
3200 ChatID ChatID `json:"chat_id"`
3201 MessageID int `json:"message_id"`
3202 InlineMessageID string `json:"inline_message_id"`
3203 Text string `json:"text"`
3204 ParseMode string `json:"parse_mode"`
3205 DisableWebPagePreview bool `json:"disable_web_page_preview"`
3206 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3207}
3208
3209// EditMessageText creates new Telegram Bot API method editMessageText
3210// 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.
3211func EditMessageText(text string) *EditMessageTextMethod {
3212 return &EditMessageTextMethod{
3213 Text: text,
3214 }
3215}
3216
3217// 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)
3218func (m *EditMessageTextMethod) SetChatID(value ChatID) *EditMessageTextMethod {
3219 m.ChatID = value
3220 return m
3221}
3222
3223// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3224func (m *EditMessageTextMethod) SetMessageID(value int) *EditMessageTextMethod {
3225 m.MessageID = value
3226 return m
3227}
3228
3229// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3230func (m *EditMessageTextMethod) SetInlineMessageID(value string) *EditMessageTextMethod {
3231 m.InlineMessageID = value
3232 return m
3233}
3234
3235// SetText - New text of the message, 1-4096 characters after entities parsing
3236func (m *EditMessageTextMethod) SetText(value string) *EditMessageTextMethod {
3237 m.Text = value
3238 return m
3239}
3240
3241// 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.
3242func (m *EditMessageTextMethod) SetParseMode(value string) *EditMessageTextMethod {
3243 m.ParseMode = value
3244 return m
3245}
3246
3247// SetDisableWebPagePreview - Disables link previews for links in this message
3248func (m *EditMessageTextMethod) SetDisableWebPagePreview(value bool) *EditMessageTextMethod {
3249 m.DisableWebPagePreview = value
3250 return m
3251}
3252
3253// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3254func (m *EditMessageTextMethod) SetReplyMarkup(value *ReplyMarkup) *EditMessageTextMethod {
3255 m.ReplyMarkup = value
3256 return m
3257}
3258
3259// Send is used to send request using Telegram Bot Client
3260func (m *EditMessageTextMethod) Send(client Client) (res *Message, err error) {
3261 return res, client.Send("editMessageText", m, res)
3262}
3263
3264// EditMessageCaptionMethod represents Telegram Bot API method editMessageCaption
3265// 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.
3266type EditMessageCaptionMethod struct {
3267 ChatID ChatID `json:"chat_id"`
3268 MessageID int `json:"message_id"`
3269 InlineMessageID string `json:"inline_message_id"`
3270 Caption string `json:"caption"`
3271 ParseMode string `json:"parse_mode"`
3272 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3273}
3274
3275// EditMessageCaption creates new Telegram Bot API method editMessageCaption
3276// 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.
3277func EditMessageCaption() *EditMessageCaptionMethod {
3278 return &EditMessageCaptionMethod{}
3279}
3280
3281// 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)
3282func (m *EditMessageCaptionMethod) SetChatID(value ChatID) *EditMessageCaptionMethod {
3283 m.ChatID = value
3284 return m
3285}
3286
3287// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3288func (m *EditMessageCaptionMethod) SetMessageID(value int) *EditMessageCaptionMethod {
3289 m.MessageID = value
3290 return m
3291}
3292
3293// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3294func (m *EditMessageCaptionMethod) SetInlineMessageID(value string) *EditMessageCaptionMethod {
3295 m.InlineMessageID = value
3296 return m
3297}
3298
3299// SetCaption - New caption of the message, 0-1024 characters after entities parsing
3300func (m *EditMessageCaptionMethod) SetCaption(value string) *EditMessageCaptionMethod {
3301 m.Caption = value
3302 return m
3303}
3304
3305// SetParseMode - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
3306func (m *EditMessageCaptionMethod) SetParseMode(value string) *EditMessageCaptionMethod {
3307 m.ParseMode = value
3308 return m
3309}
3310
3311// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3312func (m *EditMessageCaptionMethod) SetReplyMarkup(value *ReplyMarkup) *EditMessageCaptionMethod {
3313 m.ReplyMarkup = value
3314 return m
3315}
3316
3317// Send is used to send request using Telegram Bot Client
3318func (m *EditMessageCaptionMethod) Send(client Client) (res *Message, err error) {
3319 return res, client.Send("editMessageCaption", m, res)
3320}
3321
3322// EditMessageMediaMethod represents Telegram Bot API method editMessageMedia
3323// 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.
3324type EditMessageMediaMethod struct {
3325 ChatID ChatID `json:"chat_id"`
3326 MessageID int `json:"message_id"`
3327 InlineMessageID string `json:"inline_message_id"`
3328 Media *InputMedia `json:"media"`
3329 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3330}
3331
3332// EditMessageMedia creates new Telegram Bot API method editMessageMedia
3333// 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.
3334func EditMessageMedia(media *InputMedia) *EditMessageMediaMethod {
3335 return &EditMessageMediaMethod{
3336 Media: media,
3337 }
3338}
3339
3340// 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)
3341func (m *EditMessageMediaMethod) SetChatID(value ChatID) *EditMessageMediaMethod {
3342 m.ChatID = value
3343 return m
3344}
3345
3346// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3347func (m *EditMessageMediaMethod) SetMessageID(value int) *EditMessageMediaMethod {
3348 m.MessageID = value
3349 return m
3350}
3351
3352// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3353func (m *EditMessageMediaMethod) SetInlineMessageID(value string) *EditMessageMediaMethod {
3354 m.InlineMessageID = value
3355 return m
3356}
3357
3358// SetMedia - A JSON-serialized object for a new media content of the message
3359func (m *EditMessageMediaMethod) SetMedia(value *InputMedia) *EditMessageMediaMethod {
3360 m.Media = value
3361 return m
3362}
3363
3364// SetReplyMarkup - A JSON-serialized object for a new inline keyboard.
3365func (m *EditMessageMediaMethod) SetReplyMarkup(value *ReplyMarkup) *EditMessageMediaMethod {
3366 m.ReplyMarkup = value
3367 return m
3368}
3369
3370// Send is used to send request using Telegram Bot Client
3371func (m *EditMessageMediaMethod) Send(client Client) (res *Message, err error) {
3372 return res, client.Send("editMessageMedia", m, res)
3373}
3374
3375// EditMessageReplyMarkupMethod represents Telegram Bot API method editMessageReplyMarkup
3376// 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.
3377type EditMessageReplyMarkupMethod struct {
3378 ChatID ChatID `json:"chat_id"`
3379 MessageID int `json:"message_id"`
3380 InlineMessageID string `json:"inline_message_id"`
3381 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3382}
3383
3384// EditMessageReplyMarkup creates new Telegram Bot API method editMessageReplyMarkup
3385// 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.
3386func EditMessageReplyMarkup() *EditMessageReplyMarkupMethod {
3387 return &EditMessageReplyMarkupMethod{}
3388}
3389
3390// 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)
3391func (m *EditMessageReplyMarkupMethod) SetChatID(value ChatID) *EditMessageReplyMarkupMethod {
3392 m.ChatID = value
3393 return m
3394}
3395
3396// SetMessageID - Required if inline_message_id is not specified. Identifier of the message to edit
3397func (m *EditMessageReplyMarkupMethod) SetMessageID(value int) *EditMessageReplyMarkupMethod {
3398 m.MessageID = value
3399 return m
3400}
3401
3402// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
3403func (m *EditMessageReplyMarkupMethod) SetInlineMessageID(value string) *EditMessageReplyMarkupMethod {
3404 m.InlineMessageID = value
3405 return m
3406}
3407
3408// SetReplyMarkup - A JSON-serialized object for an inline keyboard.
3409func (m *EditMessageReplyMarkupMethod) SetReplyMarkup(value *ReplyMarkup) *EditMessageReplyMarkupMethod {
3410 m.ReplyMarkup = value
3411 return m
3412}
3413
3414// Send is used to send request using Telegram Bot Client
3415func (m *EditMessageReplyMarkupMethod) Send(client Client) (res *Message, err error) {
3416 return res, client.Send("editMessageReplyMarkup", m, res)
3417}
3418
3419// StopPollMethod represents Telegram Bot API method stopPoll
3420// Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
3421type StopPollMethod struct {
3422 ChatID ChatID `json:"chat_id"`
3423 MessageID int `json:"message_id"`
3424 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3425}
3426
3427// StopPoll creates new Telegram Bot API method stopPoll
3428// Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
3429func StopPoll(chatID ChatID, messageID int) *StopPollMethod {
3430 return &StopPollMethod{
3431 ChatID: chatID,
3432 MessageID: messageID,
3433 }
3434}
3435
3436// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3437func (m *StopPollMethod) SetChatID(value ChatID) *StopPollMethod {
3438 m.ChatID = value
3439 return m
3440}
3441
3442// SetMessageID - Identifier of the original message with the poll
3443func (m *StopPollMethod) SetMessageID(value int) *StopPollMethod {
3444 m.MessageID = value
3445 return m
3446}
3447
3448// SetReplyMarkup - A JSON-serialized object for a new message inline keyboard.
3449func (m *StopPollMethod) SetReplyMarkup(value *ReplyMarkup) *StopPollMethod {
3450 m.ReplyMarkup = value
3451 return m
3452}
3453
3454// Send is used to send request using Telegram Bot Client
3455func (m *StopPollMethod) Send(client Client) (res *Poll, err error) {
3456 return res, client.Send("stopPoll", m, res)
3457}
3458
3459// DeleteMessageMethod represents Telegram Bot API method deleteMessage
3460// 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.
3461type DeleteMessageMethod struct {
3462 ChatID ChatID `json:"chat_id"`
3463 MessageID int `json:"message_id"`
3464}
3465
3466// DeleteMessage creates new Telegram Bot API method deleteMessage
3467// 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.
3468func DeleteMessage(chatID ChatID, messageID int) *DeleteMessageMethod {
3469 return &DeleteMessageMethod{
3470 ChatID: chatID,
3471 MessageID: messageID,
3472 }
3473}
3474
3475// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3476func (m *DeleteMessageMethod) SetChatID(value ChatID) *DeleteMessageMethod {
3477 m.ChatID = value
3478 return m
3479}
3480
3481// SetMessageID - Identifier of the message to delete
3482func (m *DeleteMessageMethod) SetMessageID(value int) *DeleteMessageMethod {
3483 m.MessageID = value
3484 return m
3485}
3486
3487// Send is used to send request using Telegram Bot Client
3488func (m *DeleteMessageMethod) Send(client Client) (res *bool, err error) {
3489 return res, client.Send("deleteMessage", m, res)
3490}
3491
3492// SendStickerMethod represents Telegram Bot API method sendSticker
3493// Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
3494type SendStickerMethod struct {
3495 ChatID ChatID `json:"chat_id"`
3496 Sticker *InputFile `json:"sticker"`
3497 DisableNotification bool `json:"disable_notification"`
3498 ReplyToMessageID int `json:"reply_to_message_id"`
3499 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3500}
3501
3502// SendSticker creates new Telegram Bot API method sendSticker
3503// Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
3504func SendSticker(chatID ChatID, sticker *InputFile) *SendStickerMethod {
3505 return &SendStickerMethod{
3506 ChatID: chatID,
3507 Sticker: sticker,
3508 }
3509}
3510
3511// SetChatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3512func (m *SendStickerMethod) SetChatID(value ChatID) *SendStickerMethod {
3513 m.ChatID = value
3514 return m
3515}
3516
3517// 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 »
3518func (m *SendStickerMethod) SetSticker(value *InputFile) *SendStickerMethod {
3519 m.Sticker = value
3520 return m
3521}
3522
3523// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
3524func (m *SendStickerMethod) SetDisableNotification(value bool) *SendStickerMethod {
3525 m.DisableNotification = value
3526 return m
3527}
3528
3529// SetReplyToMessageID - If the message is a reply, ID of the original message
3530func (m *SendStickerMethod) SetReplyToMessageID(value int) *SendStickerMethod {
3531 m.ReplyToMessageID = value
3532 return m
3533}
3534
3535// 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.
3536func (m *SendStickerMethod) SetReplyMarkup(value *ReplyMarkup) *SendStickerMethod {
3537 m.ReplyMarkup = value
3538 return m
3539}
3540
3541// Send is used to send request using Telegram Bot Client
3542func (m *SendStickerMethod) Send(client Client) (res *Message, err error) {
3543 return res, client.Send("sendSticker", m, res)
3544}
3545
3546// GetStickerSetMethod represents Telegram Bot API method getStickerSet
3547// Use this method to get a sticker set. On success, a StickerSet object is returned.
3548type GetStickerSetMethod struct {
3549 Name string `json:"name"`
3550}
3551
3552// GetStickerSet creates new Telegram Bot API method getStickerSet
3553// Use this method to get a sticker set. On success, a StickerSet object is returned.
3554func GetStickerSet(name string) *GetStickerSetMethod {
3555 return &GetStickerSetMethod{
3556 Name: name,
3557 }
3558}
3559
3560// SetName - Name of the sticker set
3561func (m *GetStickerSetMethod) SetName(value string) *GetStickerSetMethod {
3562 m.Name = value
3563 return m
3564}
3565
3566// Send is used to send request using Telegram Bot Client
3567func (m *GetStickerSetMethod) Send(client Client) (res *StickerSet, err error) {
3568 return res, client.Send("getStickerSet", m, res)
3569}
3570
3571// UploadStickerFileMethod represents Telegram Bot API method uploadStickerFile
3572// 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.
3573type UploadStickerFileMethod struct {
3574 UserID int `json:"user_id"`
3575 PngSticker *InputFile `json:"png_sticker"`
3576}
3577
3578// UploadStickerFile creates new Telegram Bot API method uploadStickerFile
3579// 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.
3580func UploadStickerFile(userID int, pngSticker *InputFile) *UploadStickerFileMethod {
3581 return &UploadStickerFileMethod{
3582 UserID: userID,
3583 PngSticker: pngSticker,
3584 }
3585}
3586
3587// SetUserID - User identifier of sticker file owner
3588func (m *UploadStickerFileMethod) SetUserID(value int) *UploadStickerFileMethod {
3589 m.UserID = value
3590 return m
3591}
3592
3593// 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 »
3594func (m *UploadStickerFileMethod) SetPngSticker(value *InputFile) *UploadStickerFileMethod {
3595 m.PngSticker = value
3596 return m
3597}
3598
3599// Send is used to send request using Telegram Bot Client
3600func (m *UploadStickerFileMethod) Send(client Client) (res *File, err error) {
3601 return res, client.Send("uploadStickerFile", m, res)
3602}
3603
3604// CreateNewStickerSetMethod represents Telegram Bot API method createNewStickerSet
3605// 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.
3606type CreateNewStickerSetMethod struct {
3607 UserID int `json:"user_id"`
3608 Name string `json:"name"`
3609 Title string `json:"title"`
3610 PngSticker *InputFile `json:"png_sticker"`
3611 Emojis string `json:"emojis"`
3612 ContainsMasks bool `json:"contains_masks"`
3613 MaskPosition *MaskPosition `json:"mask_position"`
3614}
3615
3616// CreateNewStickerSet creates new Telegram Bot API method createNewStickerSet
3617// 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.
3618func CreateNewStickerSet(userID int, name string, title string, pngSticker *InputFile, emojis string) *CreateNewStickerSetMethod {
3619 return &CreateNewStickerSetMethod{
3620 UserID: userID,
3621 Name: name,
3622 Title: title,
3623 PngSticker: pngSticker,
3624 Emojis: emojis,
3625 }
3626}
3627
3628// SetUserID - User identifier of created sticker set owner
3629func (m *CreateNewStickerSetMethod) SetUserID(value int) *CreateNewStickerSetMethod {
3630 m.UserID = value
3631 return m
3632}
3633
3634// 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.
3635func (m *CreateNewStickerSetMethod) SetName(value string) *CreateNewStickerSetMethod {
3636 m.Name = value
3637 return m
3638}
3639
3640// SetTitle - Sticker set title, 1-64 characters
3641func (m *CreateNewStickerSetMethod) SetTitle(value string) *CreateNewStickerSetMethod {
3642 m.Title = value
3643 return m
3644}
3645
3646// 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 »
3647func (m *CreateNewStickerSetMethod) SetPngSticker(value *InputFile) *CreateNewStickerSetMethod {
3648 m.PngSticker = value
3649 return m
3650}
3651
3652// SetEmojis - One or more emoji corresponding to the sticker
3653func (m *CreateNewStickerSetMethod) SetEmojis(value string) *CreateNewStickerSetMethod {
3654 m.Emojis = value
3655 return m
3656}
3657
3658// SetContainsMasks - Pass True, if a set of mask stickers should be created
3659func (m *CreateNewStickerSetMethod) SetContainsMasks(value bool) *CreateNewStickerSetMethod {
3660 m.ContainsMasks = value
3661 return m
3662}
3663
3664// SetMaskPosition - A JSON-serialized object for position where the mask should be placed on faces
3665func (m *CreateNewStickerSetMethod) SetMaskPosition(value *MaskPosition) *CreateNewStickerSetMethod {
3666 m.MaskPosition = value
3667 return m
3668}
3669
3670// Send is used to send request using Telegram Bot Client
3671func (m *CreateNewStickerSetMethod) Send(client Client) (res *bool, err error) {
3672 return res, client.Send("createNewStickerSet", m, res)
3673}
3674
3675// AddStickerToSetMethod represents Telegram Bot API method addStickerToSet
3676// Use this method to add a new sticker to a set created by the bot. Returns True on success.
3677type AddStickerToSetMethod struct {
3678 UserID int `json:"user_id"`
3679 Name string `json:"name"`
3680 PngSticker *InputFile `json:"png_sticker"`
3681 Emojis string `json:"emojis"`
3682 MaskPosition *MaskPosition `json:"mask_position"`
3683}
3684
3685// AddStickerToSet creates new Telegram Bot API method addStickerToSet
3686// Use this method to add a new sticker to a set created by the bot. Returns True on success.
3687func AddStickerToSet(userID int, name string, pngSticker *InputFile, emojis string) *AddStickerToSetMethod {
3688 return &AddStickerToSetMethod{
3689 UserID: userID,
3690 Name: name,
3691 PngSticker: pngSticker,
3692 Emojis: emojis,
3693 }
3694}
3695
3696// SetUserID - User identifier of sticker set owner
3697func (m *AddStickerToSetMethod) SetUserID(value int) *AddStickerToSetMethod {
3698 m.UserID = value
3699 return m
3700}
3701
3702// SetName - Sticker set name
3703func (m *AddStickerToSetMethod) SetName(value string) *AddStickerToSetMethod {
3704 m.Name = value
3705 return m
3706}
3707
3708// 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 »
3709func (m *AddStickerToSetMethod) SetPngSticker(value *InputFile) *AddStickerToSetMethod {
3710 m.PngSticker = value
3711 return m
3712}
3713
3714// SetEmojis - One or more emoji corresponding to the sticker
3715func (m *AddStickerToSetMethod) SetEmojis(value string) *AddStickerToSetMethod {
3716 m.Emojis = value
3717 return m
3718}
3719
3720// SetMaskPosition - A JSON-serialized object for position where the mask should be placed on faces
3721func (m *AddStickerToSetMethod) SetMaskPosition(value *MaskPosition) *AddStickerToSetMethod {
3722 m.MaskPosition = value
3723 return m
3724}
3725
3726// Send is used to send request using Telegram Bot Client
3727func (m *AddStickerToSetMethod) Send(client Client) (res *bool, err error) {
3728 return res, client.Send("addStickerToSet", m, res)
3729}
3730
3731// SetStickerPositionInSetMethod represents Telegram Bot API method setStickerPositionInSet
3732// Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
3733type SetStickerPositionInSetMethod struct {
3734 Sticker string `json:"sticker"`
3735 Position int `json:"position"`
3736}
3737
3738// SetStickerPositionInSet creates new Telegram Bot API method setStickerPositionInSet
3739// Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
3740func SetStickerPositionInSet(sticker string, position int) *SetStickerPositionInSetMethod {
3741 return &SetStickerPositionInSetMethod{
3742 Sticker: sticker,
3743 Position: position,
3744 }
3745}
3746
3747// SetSticker - File identifier of the sticker
3748func (m *SetStickerPositionInSetMethod) SetSticker(value string) *SetStickerPositionInSetMethod {
3749 m.Sticker = value
3750 return m
3751}
3752
3753// SetPosition - New sticker position in the set, zero-based
3754func (m *SetStickerPositionInSetMethod) SetPosition(value int) *SetStickerPositionInSetMethod {
3755 m.Position = value
3756 return m
3757}
3758
3759// Send is used to send request using Telegram Bot Client
3760func (m *SetStickerPositionInSetMethod) Send(client Client) (res *bool, err error) {
3761 return res, client.Send("setStickerPositionInSet", m, res)
3762}
3763
3764// DeleteStickerFromSetMethod represents Telegram Bot API method deleteStickerFromSet
3765// Use this method to delete a sticker from a set created by the bot. Returns True on success.
3766type DeleteStickerFromSetMethod struct {
3767 Sticker string `json:"sticker"`
3768}
3769
3770// DeleteStickerFromSet creates new Telegram Bot API method deleteStickerFromSet
3771// Use this method to delete a sticker from a set created by the bot. Returns True on success.
3772func DeleteStickerFromSet(sticker string) *DeleteStickerFromSetMethod {
3773 return &DeleteStickerFromSetMethod{
3774 Sticker: sticker,
3775 }
3776}
3777
3778// SetSticker - File identifier of the sticker
3779func (m *DeleteStickerFromSetMethod) SetSticker(value string) *DeleteStickerFromSetMethod {
3780 m.Sticker = value
3781 return m
3782}
3783
3784// Send is used to send request using Telegram Bot Client
3785func (m *DeleteStickerFromSetMethod) Send(client Client) (res *bool, err error) {
3786 return res, client.Send("deleteStickerFromSet", m, res)
3787}
3788
3789// AnswerInlineQueryMethod represents Telegram Bot API method answerInlineQuery
3790// Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed.
3791type AnswerInlineQueryMethod struct {
3792 InlineQueryID string `json:"inline_query_id"`
3793 Results []*InlineQueryResult `json:"results"`
3794 CacheTime int `json:"cache_time"`
3795 IsPersonal bool `json:"is_personal"`
3796 NextOffset string `json:"next_offset"`
3797 SwitchPmText string `json:"switch_pm_text"`
3798 SwitchPmParameter string `json:"switch_pm_parameter"`
3799}
3800
3801// AnswerInlineQuery creates new Telegram Bot API method answerInlineQuery
3802// Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed.
3803func AnswerInlineQuery(inlineQueryID string, results []*InlineQueryResult) *AnswerInlineQueryMethod {
3804 return &AnswerInlineQueryMethod{
3805 InlineQueryID: inlineQueryID,
3806 Results: results,
3807 }
3808}
3809
3810// SetInlineQueryID - Unique identifier for the answered query
3811func (m *AnswerInlineQueryMethod) SetInlineQueryID(value string) *AnswerInlineQueryMethod {
3812 m.InlineQueryID = value
3813 return m
3814}
3815
3816// SetResults - A JSON-serialized array of results for the inline query
3817func (m *AnswerInlineQueryMethod) SetResults(value []*InlineQueryResult) *AnswerInlineQueryMethod {
3818 m.Results = value
3819 return m
3820}
3821
3822// SetCacheTime - The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
3823func (m *AnswerInlineQueryMethod) SetCacheTime(value int) *AnswerInlineQueryMethod {
3824 m.CacheTime = value
3825 return m
3826}
3827
3828// 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
3829func (m *AnswerInlineQueryMethod) SetIsPersonal(value bool) *AnswerInlineQueryMethod {
3830 m.IsPersonal = value
3831 return m
3832}
3833
3834// 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.
3835func (m *AnswerInlineQueryMethod) SetNextOffset(value string) *AnswerInlineQueryMethod {
3836 m.NextOffset = value
3837 return m
3838}
3839
3840// 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
3841func (m *AnswerInlineQueryMethod) SetSwitchPmText(value string) *AnswerInlineQueryMethod {
3842 m.SwitchPmText = value
3843 return m
3844}
3845
3846// 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.
3847func (m *AnswerInlineQueryMethod) SetSwitchPmParameter(value string) *AnswerInlineQueryMethod {
3848 m.SwitchPmParameter = value
3849 return m
3850}
3851
3852// Send is used to send request using Telegram Bot Client
3853func (m *AnswerInlineQueryMethod) Send(client Client) (res *bool, err error) {
3854 return res, client.Send("answerInlineQuery", m, res)
3855}
3856
3857// SendInvoiceMethod represents Telegram Bot API method sendInvoice
3858// Use this method to send invoices. On success, the sent Message is returned.
3859type SendInvoiceMethod struct {
3860 ChatID int `json:"chat_id"`
3861 Title string `json:"title"`
3862 Description string `json:"description"`
3863 Payload string `json:"payload"`
3864 ProviderToken string `json:"provider_token"`
3865 StartParameter string `json:"start_parameter"`
3866 Currency string `json:"currency"`
3867 Prices []*LabeledPrice `json:"prices"`
3868 ProviderData string `json:"provider_data"`
3869 PhotoURL string `json:"photo_url"`
3870 PhotoSize int `json:"photo_size"`
3871 PhotoWidth int `json:"photo_width"`
3872 PhotoHeight int `json:"photo_height"`
3873 NeedName bool `json:"need_name"`
3874 NeedPhoneNumber bool `json:"need_phone_number"`
3875 NeedEmail bool `json:"need_email"`
3876 NeedShippingAddress bool `json:"need_shipping_address"`
3877 SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider"`
3878 SendEmailToProvider bool `json:"send_email_to_provider"`
3879 IsFlexible bool `json:"is_flexible"`
3880 DisableNotification bool `json:"disable_notification"`
3881 ReplyToMessageID int `json:"reply_to_message_id"`
3882 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
3883}
3884
3885// SendInvoice creates new Telegram Bot API method sendInvoice
3886// Use this method to send invoices. On success, the sent Message is returned.
3887func SendInvoice(chatID int, title string, description string, payload string, providerToken string, startParameter string, currency string, prices []*LabeledPrice) *SendInvoiceMethod {
3888 return &SendInvoiceMethod{
3889 ChatID: chatID,
3890 Title: title,
3891 Description: description,
3892 Payload: payload,
3893 ProviderToken: providerToken,
3894 StartParameter: startParameter,
3895 Currency: currency,
3896 Prices: prices,
3897 }
3898}
3899
3900// SetChatID - Unique identifier for the target private chat
3901func (m *SendInvoiceMethod) SetChatID(value int) *SendInvoiceMethod {
3902 m.ChatID = value
3903 return m
3904}
3905
3906// SetTitle - Product name, 1-32 characters
3907func (m *SendInvoiceMethod) SetTitle(value string) *SendInvoiceMethod {
3908 m.Title = value
3909 return m
3910}
3911
3912// SetDescription - Product description, 1-255 characters
3913func (m *SendInvoiceMethod) SetDescription(value string) *SendInvoiceMethod {
3914 m.Description = value
3915 return m
3916}
3917
3918// SetPayload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
3919func (m *SendInvoiceMethod) SetPayload(value string) *SendInvoiceMethod {
3920 m.Payload = value
3921 return m
3922}
3923
3924// SetProviderToken - Payments provider token, obtained via Botfather
3925func (m *SendInvoiceMethod) SetProviderToken(value string) *SendInvoiceMethod {
3926 m.ProviderToken = value
3927 return m
3928}
3929
3930// SetStartParameter - Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
3931func (m *SendInvoiceMethod) SetStartParameter(value string) *SendInvoiceMethod {
3932 m.StartParameter = value
3933 return m
3934}
3935
3936// SetCurrency - Three-letter ISO 4217 currency code, see more on currencies
3937func (m *SendInvoiceMethod) SetCurrency(value string) *SendInvoiceMethod {
3938 m.Currency = value
3939 return m
3940}
3941
3942// SetPrices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
3943func (m *SendInvoiceMethod) SetPrices(value []*LabeledPrice) *SendInvoiceMethod {
3944 m.Prices = value
3945 return m
3946}
3947
3948// 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.
3949func (m *SendInvoiceMethod) SetProviderData(value string) *SendInvoiceMethod {
3950 m.ProviderData = value
3951 return m
3952}
3953
3954// 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.
3955func (m *SendInvoiceMethod) SetPhotoURL(value string) *SendInvoiceMethod {
3956 m.PhotoURL = value
3957 return m
3958}
3959
3960// SetPhotoSize - Photo size
3961func (m *SendInvoiceMethod) SetPhotoSize(value int) *SendInvoiceMethod {
3962 m.PhotoSize = value
3963 return m
3964}
3965
3966// SetPhotoWidth - Photo width
3967func (m *SendInvoiceMethod) SetPhotoWidth(value int) *SendInvoiceMethod {
3968 m.PhotoWidth = value
3969 return m
3970}
3971
3972// SetPhotoHeight - Photo height
3973func (m *SendInvoiceMethod) SetPhotoHeight(value int) *SendInvoiceMethod {
3974 m.PhotoHeight = value
3975 return m
3976}
3977
3978// SetNeedName - Pass True, if you require the user's full name to complete the order
3979func (m *SendInvoiceMethod) SetNeedName(value bool) *SendInvoiceMethod {
3980 m.NeedName = value
3981 return m
3982}
3983
3984// SetNeedPhoneNumber - Pass True, if you require the user's phone number to complete the order
3985func (m *SendInvoiceMethod) SetNeedPhoneNumber(value bool) *SendInvoiceMethod {
3986 m.NeedPhoneNumber = value
3987 return m
3988}
3989
3990// SetNeedEmail - Pass True, if you require the user's email address to complete the order
3991func (m *SendInvoiceMethod) SetNeedEmail(value bool) *SendInvoiceMethod {
3992 m.NeedEmail = value
3993 return m
3994}
3995
3996// SetNeedShippingAddress - Pass True, if you require the user's shipping address to complete the order
3997func (m *SendInvoiceMethod) SetNeedShippingAddress(value bool) *SendInvoiceMethod {
3998 m.NeedShippingAddress = value
3999 return m
4000}
4001
4002// SetSendPhoneNumberToProvider - Pass True, if user's phone number should be sent to provider
4003func (m *SendInvoiceMethod) SetSendPhoneNumberToProvider(value bool) *SendInvoiceMethod {
4004 m.SendPhoneNumberToProvider = value
4005 return m
4006}
4007
4008// SetSendEmailToProvider - Pass True, if user's email address should be sent to provider
4009func (m *SendInvoiceMethod) SetSendEmailToProvider(value bool) *SendInvoiceMethod {
4010 m.SendEmailToProvider = value
4011 return m
4012}
4013
4014// SetIsFlexible - Pass True, if the final price depends on the shipping method
4015func (m *SendInvoiceMethod) SetIsFlexible(value bool) *SendInvoiceMethod {
4016 m.IsFlexible = value
4017 return m
4018}
4019
4020// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
4021func (m *SendInvoiceMethod) SetDisableNotification(value bool) *SendInvoiceMethod {
4022 m.DisableNotification = value
4023 return m
4024}
4025
4026// SetReplyToMessageID - If the message is a reply, ID of the original message
4027func (m *SendInvoiceMethod) SetReplyToMessageID(value int) *SendInvoiceMethod {
4028 m.ReplyToMessageID = value
4029 return m
4030}
4031
4032// 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.
4033func (m *SendInvoiceMethod) SetReplyMarkup(value *ReplyMarkup) *SendInvoiceMethod {
4034 m.ReplyMarkup = value
4035 return m
4036}
4037
4038// Send is used to send request using Telegram Bot Client
4039func (m *SendInvoiceMethod) Send(client Client) (res *Message, err error) {
4040 return res, client.Send("sendInvoice", m, res)
4041}
4042
4043// AnswerShippingQueryMethod represents Telegram Bot API method answerShippingQuery
4044// 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.
4045type AnswerShippingQueryMethod struct {
4046 ShippingQueryID string `json:"shipping_query_id"`
4047 Ok bool `json:"ok"`
4048 ShippingOptions []*ShippingOption `json:"shipping_options"`
4049 ErrorMessage string `json:"error_message"`
4050}
4051
4052// AnswerShippingQuery creates new Telegram Bot API method answerShippingQuery
4053// 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.
4054func AnswerShippingQuery(shippingQueryID string, ok bool) *AnswerShippingQueryMethod {
4055 return &AnswerShippingQueryMethod{
4056 ShippingQueryID: shippingQueryID,
4057 Ok: ok,
4058 }
4059}
4060
4061// SetShippingQueryID - Unique identifier for the query to be answered
4062func (m *AnswerShippingQueryMethod) SetShippingQueryID(value string) *AnswerShippingQueryMethod {
4063 m.ShippingQueryID = value
4064 return m
4065}
4066
4067// 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)
4068func (m *AnswerShippingQueryMethod) SetOk(value bool) *AnswerShippingQueryMethod {
4069 m.Ok = value
4070 return m
4071}
4072
4073// SetShippingOptions - Required if ok is True. A JSON-serialized array of available shipping options.
4074func (m *AnswerShippingQueryMethod) SetShippingOptions(value []*ShippingOption) *AnswerShippingQueryMethod {
4075 m.ShippingOptions = value
4076 return m
4077}
4078
4079// 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.
4080func (m *AnswerShippingQueryMethod) SetErrorMessage(value string) *AnswerShippingQueryMethod {
4081 m.ErrorMessage = value
4082 return m
4083}
4084
4085// Send is used to send request using Telegram Bot Client
4086func (m *AnswerShippingQueryMethod) Send(client Client) (res *bool, err error) {
4087 return res, client.Send("answerShippingQuery", m, res)
4088}
4089
4090// AnswerPreCheckoutQueryMethod represents Telegram Bot API method answerPreCheckoutQuery
4091// 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.
4092type AnswerPreCheckoutQueryMethod struct {
4093 PreCheckoutQueryID string `json:"pre_checkout_query_id"`
4094 Ok bool `json:"ok"`
4095 ErrorMessage string `json:"error_message"`
4096}
4097
4098// AnswerPreCheckoutQuery creates new Telegram Bot API method answerPreCheckoutQuery
4099// 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.
4100func AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool) *AnswerPreCheckoutQueryMethod {
4101 return &AnswerPreCheckoutQueryMethod{
4102 PreCheckoutQueryID: preCheckoutQueryID,
4103 Ok: ok,
4104 }
4105}
4106
4107// SetPreCheckoutQueryID - Unique identifier for the query to be answered
4108func (m *AnswerPreCheckoutQueryMethod) SetPreCheckoutQueryID(value string) *AnswerPreCheckoutQueryMethod {
4109 m.PreCheckoutQueryID = value
4110 return m
4111}
4112
4113// 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.
4114func (m *AnswerPreCheckoutQueryMethod) SetOk(value bool) *AnswerPreCheckoutQueryMethod {
4115 m.Ok = value
4116 return m
4117}
4118
4119// 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.
4120func (m *AnswerPreCheckoutQueryMethod) SetErrorMessage(value string) *AnswerPreCheckoutQueryMethod {
4121 m.ErrorMessage = value
4122 return m
4123}
4124
4125// Send is used to send request using Telegram Bot Client
4126func (m *AnswerPreCheckoutQueryMethod) Send(client Client) (res *bool, err error) {
4127 return res, client.Send("answerPreCheckoutQuery", m, res)
4128}
4129
4130// SetPassportDataErrorsMethod represents Telegram Bot API method setPassportDataErrors
4131// 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.
4132type SetPassportDataErrorsMethod struct {
4133 UserID int `json:"user_id"`
4134 Errors []*PassportElementError `json:"errors"`
4135}
4136
4137// SetPassportDataErrors creates new Telegram Bot API method setPassportDataErrors
4138// 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.
4139func SetPassportDataErrors(userID int, errors []*PassportElementError) *SetPassportDataErrorsMethod {
4140 return &SetPassportDataErrorsMethod{
4141 UserID: userID,
4142 Errors: errors,
4143 }
4144}
4145
4146// SetUserID - User identifier
4147func (m *SetPassportDataErrorsMethod) SetUserID(value int) *SetPassportDataErrorsMethod {
4148 m.UserID = value
4149 return m
4150}
4151
4152// SetErrors - A JSON-serialized array describing the errors
4153func (m *SetPassportDataErrorsMethod) SetErrors(value []*PassportElementError) *SetPassportDataErrorsMethod {
4154 m.Errors = value
4155 return m
4156}
4157
4158// Send is used to send request using Telegram Bot Client
4159func (m *SetPassportDataErrorsMethod) Send(client Client) (res *bool, err error) {
4160 return res, client.Send("setPassportDataErrors", m, res)
4161}
4162
4163// SendGameMethod represents Telegram Bot API method sendGame
4164// Use this method to send a game. On success, the sent Message is returned.
4165type SendGameMethod struct {
4166 ChatID int `json:"chat_id"`
4167 GameShortName string `json:"game_short_name"`
4168 DisableNotification bool `json:"disable_notification"`
4169 ReplyToMessageID int `json:"reply_to_message_id"`
4170 ReplyMarkup *ReplyMarkup `json:"reply_markup"`
4171}
4172
4173// SendGame creates new Telegram Bot API method sendGame
4174// Use this method to send a game. On success, the sent Message is returned.
4175func SendGame(chatID int, gameShortName string) *SendGameMethod {
4176 return &SendGameMethod{
4177 ChatID: chatID,
4178 GameShortName: gameShortName,
4179 }
4180}
4181
4182// SetChatID - Unique identifier for the target chat
4183func (m *SendGameMethod) SetChatID(value int) *SendGameMethod {
4184 m.ChatID = value
4185 return m
4186}
4187
4188// SetGameShortName - Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
4189func (m *SendGameMethod) SetGameShortName(value string) *SendGameMethod {
4190 m.GameShortName = value
4191 return m
4192}
4193
4194// SetDisableNotification - Sends the message silently. Users will receive a notification with no sound.
4195func (m *SendGameMethod) SetDisableNotification(value bool) *SendGameMethod {
4196 m.DisableNotification = value
4197 return m
4198}
4199
4200// SetReplyToMessageID - If the message is a reply, ID of the original message
4201func (m *SendGameMethod) SetReplyToMessageID(value int) *SendGameMethod {
4202 m.ReplyToMessageID = value
4203 return m
4204}
4205
4206// 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.
4207func (m *SendGameMethod) SetReplyMarkup(value *ReplyMarkup) *SendGameMethod {
4208 m.ReplyMarkup = value
4209 return m
4210}
4211
4212// Send is used to send request using Telegram Bot Client
4213func (m *SendGameMethod) Send(client Client) (res *Message, err error) {
4214 return res, client.Send("sendGame", m, res)
4215}
4216
4217// SetGameScoreMethod represents Telegram Bot API method setGameScore
4218// 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.
4219type SetGameScoreMethod struct {
4220 UserID int `json:"user_id"`
4221 Score int `json:"score"`
4222 Force bool `json:"force"`
4223 DisableEditMessage bool `json:"disable_edit_message"`
4224 ChatID int `json:"chat_id"`
4225 MessageID int `json:"message_id"`
4226 InlineMessageID string `json:"inline_message_id"`
4227}
4228
4229// SetGameScore creates new Telegram Bot API method setGameScore
4230// 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.
4231func SetGameScore(userID int, score int) *SetGameScoreMethod {
4232 return &SetGameScoreMethod{
4233 UserID: userID,
4234 Score: score,
4235 }
4236}
4237
4238// SetUserID - User identifier
4239func (m *SetGameScoreMethod) SetUserID(value int) *SetGameScoreMethod {
4240 m.UserID = value
4241 return m
4242}
4243
4244// SetScore - New score, must be non-negative
4245func (m *SetGameScoreMethod) SetScore(value int) *SetGameScoreMethod {
4246 m.Score = value
4247 return m
4248}
4249
4250// SetForce - Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
4251func (m *SetGameScoreMethod) SetForce(value bool) *SetGameScoreMethod {
4252 m.Force = value
4253 return m
4254}
4255
4256// SetDisableEditMessage - Pass True, if the game message should not be automatically edited to include the current scoreboard
4257func (m *SetGameScoreMethod) SetDisableEditMessage(value bool) *SetGameScoreMethod {
4258 m.DisableEditMessage = value
4259 return m
4260}
4261
4262// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat
4263func (m *SetGameScoreMethod) SetChatID(value int) *SetGameScoreMethod {
4264 m.ChatID = value
4265 return m
4266}
4267
4268// SetMessageID - Required if inline_message_id is not specified. Identifier of the sent message
4269func (m *SetGameScoreMethod) SetMessageID(value int) *SetGameScoreMethod {
4270 m.MessageID = value
4271 return m
4272}
4273
4274// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
4275func (m *SetGameScoreMethod) SetInlineMessageID(value string) *SetGameScoreMethod {
4276 m.InlineMessageID = value
4277 return m
4278}
4279
4280// Send is used to send request using Telegram Bot Client
4281func (m *SetGameScoreMethod) Send(client Client) (res *Message, err error) {
4282 return res, client.Send("setGameScore", m, res)
4283}
4284
4285// GetGameHighScoresMethod represents Telegram Bot API method getGameHighScores
4286// 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.
4287type GetGameHighScoresMethod struct {
4288 UserID int `json:"user_id"`
4289 ChatID int `json:"chat_id"`
4290 MessageID int `json:"message_id"`
4291 InlineMessageID string `json:"inline_message_id"`
4292}
4293
4294// GetGameHighScores creates new Telegram Bot API method getGameHighScores
4295// 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.
4296func GetGameHighScores(userID int) *GetGameHighScoresMethod {
4297 return &GetGameHighScoresMethod{
4298 UserID: userID,
4299 }
4300}
4301
4302// SetUserID - Target user id
4303func (m *GetGameHighScoresMethod) SetUserID(value int) *GetGameHighScoresMethod {
4304 m.UserID = value
4305 return m
4306}
4307
4308// SetChatID - Required if inline_message_id is not specified. Unique identifier for the target chat
4309func (m *GetGameHighScoresMethod) SetChatID(value int) *GetGameHighScoresMethod {
4310 m.ChatID = value
4311 return m
4312}
4313
4314// SetMessageID - Required if inline_message_id is not specified. Identifier of the sent message
4315func (m *GetGameHighScoresMethod) SetMessageID(value int) *GetGameHighScoresMethod {
4316 m.MessageID = value
4317 return m
4318}
4319
4320// SetInlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message
4321func (m *GetGameHighScoresMethod) SetInlineMessageID(value string) *GetGameHighScoresMethod {
4322 m.InlineMessageID = value
4323 return m
4324}
4325
4326// Send is used to send request using Telegram Bot Client
4327func (m *GetGameHighScoresMethod) Send(client Client) (res []*GameHighScore, err error) {
4328 return res, client.Send("getGameHighScores", m, res)
4329}