go-tg-screenshot-bot
927 строк · 24.8 Кб
1package tgbotapi2
3import (4"net/url"5)
6
7// NewMessage creates a new Message.
8//
9// chatID is where to send it, text is the message text.
10func NewMessage(chatID int64, text string) MessageConfig {11return MessageConfig{12BaseChat: BaseChat{13ChatID: chatID,14ReplyToMessageID: 0,15},16Text: text,17DisableWebPagePreview: false,18}19}
20
21// NewDeleteMessage creates a request to delete a message.
22func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig {23return DeleteMessageConfig{24ChatID: chatID,25MessageID: messageID,26}27}
28
29// NewMessageToChannel creates a new Message that is sent to a channel
30// by username.
31//
32// username is the username of the channel, text is the message text,
33// and the username should be in the form of `@username`.
34func NewMessageToChannel(username string, text string) MessageConfig {35return MessageConfig{36BaseChat: BaseChat{37ChannelUsername: username,38},39Text: text,40}41}
42
43// NewForward creates a new forward.
44//
45// chatID is where to send it, fromChatID is the source chat,
46// and messageID is the ID of the original message.
47func NewForward(chatID int64, fromChatID int64, messageID int) ForwardConfig {48return ForwardConfig{49BaseChat: BaseChat{ChatID: chatID},50FromChatID: fromChatID,51MessageID: messageID,52}53}
54
55// NewCopyMessage creates a new copy message.
56//
57// chatID is where to send it, fromChatID is the source chat,
58// and messageID is the ID of the original message.
59func NewCopyMessage(chatID int64, fromChatID int64, messageID int) CopyMessageConfig {60return CopyMessageConfig{61BaseChat: BaseChat{ChatID: chatID},62FromChatID: fromChatID,63MessageID: messageID,64}65}
66
67// NewPhoto creates a new sendPhoto request.
68//
69// chatID is where to send it, file is a string path to the file,
70// FileReader, or FileBytes.
71//
72// Note that you must send animated GIFs as a document.
73func NewPhoto(chatID int64, file RequestFileData) PhotoConfig {74return PhotoConfig{75BaseFile: BaseFile{76BaseChat: BaseChat{ChatID: chatID},77File: file,78},79}80}
81
82// NewPhotoToChannel creates a new photo uploader to send a photo to a channel.
83//
84// Note that you must send animated GIFs as a document.
85func NewPhotoToChannel(username string, file RequestFileData) PhotoConfig {86return PhotoConfig{87BaseFile: BaseFile{88BaseChat: BaseChat{89ChannelUsername: username,90},91File: file,92},93}94}
95
96// NewAudio creates a new sendAudio request.
97func NewAudio(chatID int64, file RequestFileData) AudioConfig {98return AudioConfig{99BaseFile: BaseFile{100BaseChat: BaseChat{ChatID: chatID},101File: file,102},103}104}
105
106// NewDocument creates a new sendDocument request.
107func NewDocument(chatID int64, file RequestFileData) DocumentConfig {108return DocumentConfig{109BaseFile: BaseFile{110BaseChat: BaseChat{ChatID: chatID},111File: file,112},113}114}
115
116// NewSticker creates a new sendSticker request.
117func NewSticker(chatID int64, file RequestFileData) StickerConfig {118return StickerConfig{119BaseFile: BaseFile{120BaseChat: BaseChat{ChatID: chatID},121File: file,122},123}124}
125
126// NewVideo creates a new sendVideo request.
127func NewVideo(chatID int64, file RequestFileData) VideoConfig {128return VideoConfig{129BaseFile: BaseFile{130BaseChat: BaseChat{ChatID: chatID},131File: file,132},133}134}
135
136// NewAnimation creates a new sendAnimation request.
137func NewAnimation(chatID int64, file RequestFileData) AnimationConfig {138return AnimationConfig{139BaseFile: BaseFile{140BaseChat: BaseChat{ChatID: chatID},141File: file,142},143}144}
145
146// NewVideoNote creates a new sendVideoNote request.
147//
148// chatID is where to send it, file is a string path to the file,
149// FileReader, or FileBytes.
150func NewVideoNote(chatID int64, length int, file RequestFileData) VideoNoteConfig {151return VideoNoteConfig{152BaseFile: BaseFile{153BaseChat: BaseChat{ChatID: chatID},154File: file,155},156Length: length,157}158}
159
160// NewVoice creates a new sendVoice request.
161func NewVoice(chatID int64, file RequestFileData) VoiceConfig {162return VoiceConfig{163BaseFile: BaseFile{164BaseChat: BaseChat{ChatID: chatID},165File: file,166},167}168}
169
170// NewMediaGroup creates a new media group. Files should be an array of
171// two to ten InputMediaPhoto or InputMediaVideo.
172func NewMediaGroup(chatID int64, files []interface{}) MediaGroupConfig {173return MediaGroupConfig{174ChatID: chatID,175Media: files,176}177}
178
179// NewInputMediaPhoto creates a new InputMediaPhoto.
180func NewInputMediaPhoto(media RequestFileData) InputMediaPhoto {181return InputMediaPhoto{182BaseInputMedia{183Type: "photo",184Media: media,185},186}187}
188
189// NewInputMediaVideo creates a new InputMediaVideo.
190func NewInputMediaVideo(media RequestFileData) InputMediaVideo {191return InputMediaVideo{192BaseInputMedia: BaseInputMedia{193Type: "video",194Media: media,195},196}197}
198
199// NewInputMediaAnimation creates a new InputMediaAnimation.
200func NewInputMediaAnimation(media RequestFileData) InputMediaAnimation {201return InputMediaAnimation{202BaseInputMedia: BaseInputMedia{203Type: "animation",204Media: media,205},206}207}
208
209// NewInputMediaAudio creates a new InputMediaAudio.
210func NewInputMediaAudio(media RequestFileData) InputMediaAudio {211return InputMediaAudio{212BaseInputMedia: BaseInputMedia{213Type: "audio",214Media: media,215},216}217}
218
219// NewInputMediaDocument creates a new InputMediaDocument.
220func NewInputMediaDocument(media RequestFileData) InputMediaDocument {221return InputMediaDocument{222BaseInputMedia: BaseInputMedia{223Type: "document",224Media: media,225},226}227}
228
229// NewContact allows you to send a shared contact.
230func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {231return ContactConfig{232BaseChat: BaseChat{233ChatID: chatID,234},235PhoneNumber: phoneNumber,236FirstName: firstName,237}238}
239
240// NewLocation shares your location.
241//
242// chatID is where to send it, latitude and longitude are coordinates.
243func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig {244return LocationConfig{245BaseChat: BaseChat{246ChatID: chatID,247},248Latitude: latitude,249Longitude: longitude,250}251}
252
253// NewVenue allows you to send a venue and its location.
254func NewVenue(chatID int64, title, address string, latitude, longitude float64) VenueConfig {255return VenueConfig{256BaseChat: BaseChat{257ChatID: chatID,258},259Title: title,260Address: address,261Latitude: latitude,262Longitude: longitude,263}264}
265
266// NewChatAction sets a chat action.
267// Actions last for 5 seconds, or until your next action.
268//
269// chatID is where to send it, action should be set via Chat constants.
270func NewChatAction(chatID int64, action string) ChatActionConfig {271return ChatActionConfig{272BaseChat: BaseChat{ChatID: chatID},273Action: action,274}275}
276
277// NewUserProfilePhotos gets user profile photos.
278//
279// userID is the ID of the user you wish to get profile photos from.
280func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig {281return UserProfilePhotosConfig{282UserID: userID,283Offset: 0,284Limit: 0,285}286}
287
288// NewUpdate gets updates since the last Offset.
289//
290// offset is the last Update ID to include.
291// You likely want to set this to the last Update ID plus 1.
292func NewUpdate(offset int) UpdateConfig {293return UpdateConfig{294Offset: offset,295Limit: 0,296Timeout: 0,297}298}
299
300// NewWebhook creates a new webhook.
301//
302// link is the url parsable link you wish to get the updates.
303func NewWebhook(link string) (WebhookConfig, error) {304u, err := url.Parse(link)305
306if err != nil {307return WebhookConfig{}, err308}309
310return WebhookConfig{311URL: u,312}, nil313}
314
315// NewWebhookWithCert creates a new webhook with a certificate.
316//
317// link is the url you wish to get webhooks,
318// file contains a string to a file, FileReader, or FileBytes.
319func NewWebhookWithCert(link string, file RequestFileData) (WebhookConfig, error) {320u, err := url.Parse(link)321
322if err != nil {323return WebhookConfig{}, err324}325
326return WebhookConfig{327URL: u,328Certificate: file,329}, nil330}
331
332// NewInlineQueryResultArticle creates a new inline query article.
333func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle {334return InlineQueryResultArticle{335Type: "article",336ID: id,337Title: title,338InputMessageContent: InputTextMessageContent{339Text: messageText,340},341}342}
343
344// NewInlineQueryResultArticleMarkdown creates a new inline query article with Markdown parsing.
345func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle {346return InlineQueryResultArticle{347Type: "article",348ID: id,349Title: title,350InputMessageContent: InputTextMessageContent{351Text: messageText,352ParseMode: "Markdown",353},354}355}
356
357// NewInlineQueryResultArticleMarkdownV2 creates a new inline query article with MarkdownV2 parsing.
358func NewInlineQueryResultArticleMarkdownV2(id, title, messageText string) InlineQueryResultArticle {359return InlineQueryResultArticle{360Type: "article",361ID: id,362Title: title,363InputMessageContent: InputTextMessageContent{364Text: messageText,365ParseMode: "MarkdownV2",366},367}368}
369
370// NewInlineQueryResultArticleHTML creates a new inline query article with HTML parsing.
371func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle {372return InlineQueryResultArticle{373Type: "article",374ID: id,375Title: title,376InputMessageContent: InputTextMessageContent{377Text: messageText,378ParseMode: "HTML",379},380}381}
382
383// NewInlineQueryResultGIF creates a new inline query GIF.
384func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF {385return InlineQueryResultGIF{386Type: "gif",387ID: id,388URL: url,389}390}
391
392// NewInlineQueryResultCachedGIF create a new inline query with cached photo.
393func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF {394return InlineQueryResultCachedGIF{395Type: "gif",396ID: id,397GIFID: gifID,398}399}
400
401// NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
402func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {403return InlineQueryResultMPEG4GIF{404Type: "mpeg4_gif",405ID: id,406URL: url,407}408}
409
410// NewInlineQueryResultCachedMPEG4GIF create a new inline query with cached MPEG4 GIF.
411func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GIFID string) InlineQueryResultCachedMPEG4GIF {412return InlineQueryResultCachedMPEG4GIF{413Type: "mpeg4_gif",414ID: id,415MPEG4FileID: MPEG4GIFID,416}417}
418
419// NewInlineQueryResultPhoto creates a new inline query photo.
420func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {421return InlineQueryResultPhoto{422Type: "photo",423ID: id,424URL: url,425}426}
427
428// NewInlineQueryResultPhotoWithThumb creates a new inline query photo.
429func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto {430return InlineQueryResultPhoto{431Type: "photo",432ID: id,433URL: url,434ThumbURL: thumb,435}436}
437
438// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
439func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto {440return InlineQueryResultCachedPhoto{441Type: "photo",442ID: id,443PhotoID: photoID,444}445}
446
447// NewInlineQueryResultVideo creates a new inline query video.
448func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {449return InlineQueryResultVideo{450Type: "video",451ID: id,452URL: url,453}454}
455
456// NewInlineQueryResultCachedVideo create a new inline query with cached video.
457func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo {458return InlineQueryResultCachedVideo{459Type: "video",460ID: id,461VideoID: videoID,462Title: title,463}464}
465
466// NewInlineQueryResultCachedSticker create a new inline query with cached sticker.
467func NewInlineQueryResultCachedSticker(id, stickerID, title string) InlineQueryResultCachedSticker {468return InlineQueryResultCachedSticker{469Type: "sticker",470ID: id,471StickerID: stickerID,472Title: title,473}474}
475
476// NewInlineQueryResultAudio creates a new inline query audio.
477func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {478return InlineQueryResultAudio{479Type: "audio",480ID: id,481URL: url,482Title: title,483}484}
485
486// NewInlineQueryResultCachedAudio create a new inline query with cached photo.
487func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio {488return InlineQueryResultCachedAudio{489Type: "audio",490ID: id,491AudioID: audioID,492}493}
494
495// NewInlineQueryResultVoice creates a new inline query voice.
496func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {497return InlineQueryResultVoice{498Type: "voice",499ID: id,500URL: url,501Title: title,502}503}
504
505// NewInlineQueryResultCachedVoice create a new inline query with cached photo.
506func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice {507return InlineQueryResultCachedVoice{508Type: "voice",509ID: id,510VoiceID: voiceID,511Title: title,512}513}
514
515// NewInlineQueryResultDocument creates a new inline query document.
516func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {517return InlineQueryResultDocument{518Type: "document",519ID: id,520URL: url,521Title: title,522MimeType: mimeType,523}524}
525
526// NewInlineQueryResultCachedDocument create a new inline query with cached photo.
527func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument {528return InlineQueryResultCachedDocument{529Type: "document",530ID: id,531DocumentID: documentID,532Title: title,533}534}
535
536// NewInlineQueryResultLocation creates a new inline query location.
537func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {538return InlineQueryResultLocation{539Type: "location",540ID: id,541Title: title,542Latitude: latitude,543Longitude: longitude,544}545}
546
547// NewInlineQueryResultVenue creates a new inline query venue.
548func NewInlineQueryResultVenue(id, title, address string, latitude, longitude float64) InlineQueryResultVenue {549return InlineQueryResultVenue{550Type: "venue",551ID: id,552Title: title,553Address: address,554Latitude: latitude,555Longitude: longitude,556}557}
558
559// NewEditMessageText allows you to edit the text of a message.
560func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig {561return EditMessageTextConfig{562BaseEdit: BaseEdit{563ChatID: chatID,564MessageID: messageID,565},566Text: text,567}568}
569
570// NewEditMessageTextAndMarkup allows you to edit the text and replymarkup of a message.
571func NewEditMessageTextAndMarkup(chatID int64, messageID int, text string, replyMarkup InlineKeyboardMarkup) EditMessageTextConfig {572return EditMessageTextConfig{573BaseEdit: BaseEdit{574ChatID: chatID,575MessageID: messageID,576ReplyMarkup: &replyMarkup,577},578Text: text,579}580}
581
582// NewEditMessageCaption allows you to edit the caption of a message.
583func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig {584return EditMessageCaptionConfig{585BaseEdit: BaseEdit{586ChatID: chatID,587MessageID: messageID,588},589Caption: caption,590}591}
592
593// NewEditMessageReplyMarkup allows you to edit the inline
594// keyboard markup.
595func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig {596return EditMessageReplyMarkupConfig{597BaseEdit: BaseEdit{598ChatID: chatID,599MessageID: messageID,600ReplyMarkup: &replyMarkup,601},602}603}
604
605// NewRemoveKeyboard hides the keyboard, with the option for being selective
606// or hiding for everyone.
607func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove {608return ReplyKeyboardRemove{609RemoveKeyboard: true,610Selective: selective,611}612}
613
614// NewKeyboardButton creates a regular keyboard button.
615func NewKeyboardButton(text string) KeyboardButton {616return KeyboardButton{617Text: text,618}619}
620
621// NewKeyboardButtonContact creates a keyboard button that requests
622// user contact information upon click.
623func NewKeyboardButtonContact(text string) KeyboardButton {624return KeyboardButton{625Text: text,626RequestContact: true,627}628}
629
630// NewKeyboardButtonLocation creates a keyboard button that requests
631// user location information upon click.
632func NewKeyboardButtonLocation(text string) KeyboardButton {633return KeyboardButton{634Text: text,635RequestLocation: true,636}637}
638
639// NewKeyboardButtonRow creates a row of keyboard buttons.
640func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton {641var row []KeyboardButton642
643row = append(row, buttons...)644
645return row646}
647
648// NewReplyKeyboard creates a new regular keyboard with sane defaults.
649func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {650var keyboard [][]KeyboardButton651
652keyboard = append(keyboard, rows...)653
654return ReplyKeyboardMarkup{655ResizeKeyboard: true,656Keyboard: keyboard,657}658}
659
660// NewOneTimeReplyKeyboard creates a new one time keyboard.
661func NewOneTimeReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {662markup := NewReplyKeyboard(rows...)663markup.OneTimeKeyboard = true664return markup665}
666
667// NewInlineKeyboardButtonData creates an inline keyboard button with text
668// and data for a callback.
669func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {670return InlineKeyboardButton{671Text: text,672CallbackData: &data,673}674}
675
676// NewInlineKeyboardButtonLoginURL creates an inline keyboard button with text
677// which goes to a LoginURL.
678func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton {679return InlineKeyboardButton{680Text: text,681LoginURL: &loginURL,682}683}
684
685// NewInlineKeyboardButtonURL creates an inline keyboard button with text
686// which goes to a URL.
687func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {688return InlineKeyboardButton{689Text: text,690URL: &url,691}692}
693
694// NewInlineKeyboardButtonSwitch creates an inline keyboard button with
695// text which allows the user to switch to a chat or return to a chat.
696func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton {697return InlineKeyboardButton{698Text: text,699SwitchInlineQuery: &sw,700}701}
702
703// NewInlineKeyboardRow creates an inline keyboard row with buttons.
704func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton {705var row []InlineKeyboardButton706
707row = append(row, buttons...)708
709return row710}
711
712// NewInlineKeyboardMarkup creates a new inline keyboard.
713func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup {714var keyboard [][]InlineKeyboardButton715
716keyboard = append(keyboard, rows...)717
718return InlineKeyboardMarkup{719InlineKeyboard: keyboard,720}721}
722
723// NewCallback creates a new callback message.
724func NewCallback(id, text string) CallbackConfig {725return CallbackConfig{726CallbackQueryID: id,727Text: text,728ShowAlert: false,729}730}
731
732// NewCallbackWithAlert creates a new callback message that alerts
733// the user.
734func NewCallbackWithAlert(id, text string) CallbackConfig {735return CallbackConfig{736CallbackQueryID: id,737Text: text,738ShowAlert: true,739}740}
741
742// NewInvoice creates a new Invoice request to the user.
743func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices []LabeledPrice) InvoiceConfig {744return InvoiceConfig{745BaseChat: BaseChat{ChatID: chatID},746Title: title,747Description: description,748Payload: payload,749ProviderToken: providerToken,750StartParameter: startParameter,751Currency: currency,752Prices: prices}753}
754
755// NewChatTitle allows you to update the title of a chat.
756func NewChatTitle(chatID int64, title string) SetChatTitleConfig {757return SetChatTitleConfig{758ChatID: chatID,759Title: title,760}761}
762
763// NewChatDescription allows you to update the description of a chat.
764func NewChatDescription(chatID int64, description string) SetChatDescriptionConfig {765return SetChatDescriptionConfig{766ChatID: chatID,767Description: description,768}769}
770
771// NewChatPhoto allows you to update the photo for a chat.
772func NewChatPhoto(chatID int64, photo RequestFileData) SetChatPhotoConfig {773return SetChatPhotoConfig{774BaseFile: BaseFile{775BaseChat: BaseChat{776ChatID: chatID,777},778File: photo,779},780}781}
782
783// NewDeleteChatPhoto allows you to delete the photo for a chat.
784func NewDeleteChatPhoto(chatID int64) DeleteChatPhotoConfig {785return DeleteChatPhotoConfig{786ChatID: chatID,787}788}
789
790// NewPoll allows you to create a new poll.
791func NewPoll(chatID int64, question string, options ...string) SendPollConfig {792return SendPollConfig{793BaseChat: BaseChat{794ChatID: chatID,795},796Question: question,797Options: options,798IsAnonymous: true, // This is Telegram's default.799}800}
801
802// NewStopPoll allows you to stop a poll.
803func NewStopPoll(chatID int64, messageID int) StopPollConfig {804return StopPollConfig{805BaseEdit{806ChatID: chatID,807MessageID: messageID,808},809}810}
811
812// NewDice allows you to send a random dice roll.
813func NewDice(chatID int64) DiceConfig {814return DiceConfig{815BaseChat: BaseChat{816ChatID: chatID,817},818}819}
820
821// NewDiceWithEmoji allows you to send a random roll of one of many types.
822//
823// Emoji may be 🎲 (1-6), 🎯 (1-6), or 🏀 (1-5).
824func NewDiceWithEmoji(chatID int64, emoji string) DiceConfig {825return DiceConfig{826BaseChat: BaseChat{827ChatID: chatID,828},829Emoji: emoji,830}831}
832
833// NewBotCommandScopeDefault represents the default scope of bot commands.
834func NewBotCommandScopeDefault() BotCommandScope {835return BotCommandScope{Type: "default"}836}
837
838// NewBotCommandScopeAllPrivateChats represents the scope of bot commands,
839// covering all private chats.
840func NewBotCommandScopeAllPrivateChats() BotCommandScope {841return BotCommandScope{Type: "all_private_chats"}842}
843
844// NewBotCommandScopeAllGroupChats represents the scope of bot commands,
845// covering all group and supergroup chats.
846func NewBotCommandScopeAllGroupChats() BotCommandScope {847return BotCommandScope{Type: "all_group_chats"}848}
849
850// NewBotCommandScopeAllChatAdministrators represents the scope of bot commands,
851// covering all group and supergroup chat administrators.
852func NewBotCommandScopeAllChatAdministrators() BotCommandScope {853return BotCommandScope{Type: "all_chat_administrators"}854}
855
856// NewBotCommandScopeChat represents the scope of bot commands, covering a
857// specific chat.
858func NewBotCommandScopeChat(chatID int64) BotCommandScope {859return BotCommandScope{860Type: "chat",861ChatID: chatID,862}863}
864
865// NewBotCommandScopeChatAdministrators represents the scope of bot commands,
866// covering all administrators of a specific group or supergroup chat.
867func NewBotCommandScopeChatAdministrators(chatID int64) BotCommandScope {868return BotCommandScope{869Type: "chat_administrators",870ChatID: chatID,871}872}
873
874// NewBotCommandScopeChatMember represents the scope of bot commands, covering a
875// specific member of a group or supergroup chat.
876func NewBotCommandScopeChatMember(chatID, userID int64) BotCommandScope {877return BotCommandScope{878Type: "chat_member",879ChatID: chatID,880UserID: userID,881}882}
883
884// NewGetMyCommandsWithScope allows you to set the registered commands for a
885// given scope.
886func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig {887return GetMyCommandsConfig{Scope: &scope}888}
889
890// NewGetMyCommandsWithScopeAndLanguage allows you to set the registered
891// commands for a given scope and language code.
892func NewGetMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string) GetMyCommandsConfig {893return GetMyCommandsConfig{Scope: &scope, LanguageCode: languageCode}894}
895
896// NewSetMyCommands allows you to set the registered commands.
897func NewSetMyCommands(commands ...BotCommand) SetMyCommandsConfig {898return SetMyCommandsConfig{Commands: commands}899}
900
901// NewSetMyCommandsWithScope allows you to set the registered commands for a given scope.
902func NewSetMyCommandsWithScope(scope BotCommandScope, commands ...BotCommand) SetMyCommandsConfig {903return SetMyCommandsConfig{Commands: commands, Scope: &scope}904}
905
906// NewSetMyCommandsWithScopeAndLanguage allows you to set the registered commands for a given scope
907// and language code.
908func NewSetMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string, commands ...BotCommand) SetMyCommandsConfig {909return SetMyCommandsConfig{Commands: commands, Scope: &scope, LanguageCode: languageCode}910}
911
912// NewDeleteMyCommands allows you to delete the registered commands.
913func NewDeleteMyCommands() DeleteMyCommandsConfig {914return DeleteMyCommandsConfig{}915}
916
917// NewDeleteMyCommandsWithScope allows you to delete the registered commands for a given
918// scope.
919func NewDeleteMyCommandsWithScope(scope BotCommandScope) DeleteMyCommandsConfig {920return DeleteMyCommandsConfig{Scope: &scope}921}
922
923// NewDeleteMyCommandsWithScopeAndLanguage allows you to delete the registered commands for a given
924// scope and language code.
925func NewDeleteMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string) DeleteMyCommandsConfig {926return DeleteMyCommandsConfig{Scope: &scope, LanguageCode: languageCode}927}
928