all repos — telegram-bot-api @ d944d68fe6ebbde4aaafa592d8d0a2b935548cf8

Golang bindings for the Telegram Bot API

helpers.go (view raw)

  1package tgbotapi
  2
  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 {
 11	return MessageConfig{
 12		BaseChat: BaseChat{
 13			ChatID:           chatID,
 14			ReplyToMessageID: 0,
 15		},
 16		Text:                  text,
 17		DisableWebPagePreview: false,
 18	}
 19}
 20
 21// NewDeleteMessage creates a request to delete a message.
 22func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig {
 23	return DeleteMessageConfig{
 24		ChatID:    chatID,
 25		MessageID: 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 {
 35	return MessageConfig{
 36		BaseChat: BaseChat{
 37			ChannelUsername: username,
 38		},
 39		Text: 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 {
 48	return ForwardConfig{
 49		BaseChat:   BaseChat{ChatID: chatID},
 50		FromChatID: fromChatID,
 51		MessageID:  messageID,
 52	}
 53}
 54
 55// NewPhotoUpload creates a new photo uploader.
 56//
 57// chatID is where to send it, file is a string path to the file,
 58// FileReader, or FileBytes.
 59//
 60// Note that you must send animated GIFs as a document.
 61func NewPhotoUpload(chatID int64, file interface{}) PhotoConfig {
 62	return PhotoConfig{
 63		BaseFile: BaseFile{
 64			BaseChat:    BaseChat{ChatID: chatID},
 65			File:        file,
 66			UseExisting: false,
 67		},
 68	}
 69}
 70
 71// NewPhotoShare shares an existing photo.
 72// You may use this to reshare an existing photo without reuploading it.
 73//
 74// chatID is where to send it, fileID is the ID of the file
 75// already uploaded.
 76func NewPhotoShare(chatID int64, fileID string) PhotoConfig {
 77	return PhotoConfig{
 78		BaseFile: BaseFile{
 79			BaseChat:    BaseChat{ChatID: chatID},
 80			FileID:      fileID,
 81			UseExisting: true,
 82		},
 83	}
 84}
 85
 86// NewAudioUpload creates a new audio uploader.
 87//
 88// chatID is where to send it, file is a string path to the file,
 89// FileReader, or FileBytes.
 90func NewAudioUpload(chatID int64, file interface{}) AudioConfig {
 91	return AudioConfig{
 92		BaseFile: BaseFile{
 93			BaseChat:    BaseChat{ChatID: chatID},
 94			File:        file,
 95			UseExisting: false,
 96		},
 97	}
 98}
 99
100// NewAudioShare shares an existing audio file.
101// You may use this to reshare an existing audio file without
102// reuploading it.
103//
104// chatID is where to send it, fileID is the ID of the audio
105// already uploaded.
106func NewAudioShare(chatID int64, fileID string) AudioConfig {
107	return AudioConfig{
108		BaseFile: BaseFile{
109			BaseChat:    BaseChat{ChatID: chatID},
110			FileID:      fileID,
111			UseExisting: true,
112		},
113	}
114}
115
116// NewDocumentUpload creates a new document uploader.
117//
118// chatID is where to send it, file is a string path to the file,
119// FileReader, or FileBytes.
120func NewDocumentUpload(chatID int64, file interface{}) DocumentConfig {
121	return DocumentConfig{
122		BaseFile: BaseFile{
123			BaseChat:    BaseChat{ChatID: chatID},
124			File:        file,
125			UseExisting: false,
126		},
127	}
128}
129
130// NewDocumentShare shares an existing document.
131// You may use this to reshare an existing document without
132// reuploading it.
133//
134// chatID is where to send it, fileID is the ID of the document
135// already uploaded.
136func NewDocumentShare(chatID int64, fileID string) DocumentConfig {
137	return DocumentConfig{
138		BaseFile: BaseFile{
139			BaseChat:    BaseChat{ChatID: chatID},
140			FileID:      fileID,
141			UseExisting: true,
142		},
143	}
144}
145
146// NewStickerUpload creates a new sticker uploader.
147//
148// chatID is where to send it, file is a string path to the file,
149// FileReader, or FileBytes.
150func NewStickerUpload(chatID int64, file interface{}) StickerConfig {
151	return StickerConfig{
152		BaseFile: BaseFile{
153			BaseChat:    BaseChat{ChatID: chatID},
154			File:        file,
155			UseExisting: false,
156		},
157	}
158}
159
160// NewStickerShare shares an existing sticker.
161// You may use this to reshare an existing sticker without
162// reuploading it.
163//
164// chatID is where to send it, fileID is the ID of the sticker
165// already uploaded.
166func NewStickerShare(chatID int64, fileID string) StickerConfig {
167	return StickerConfig{
168		BaseFile: BaseFile{
169			BaseChat:    BaseChat{ChatID: chatID},
170			FileID:      fileID,
171			UseExisting: true,
172		},
173	}
174}
175
176// NewVideoUpload creates a new video uploader.
177//
178// chatID is where to send it, file is a string path to the file,
179// FileReader, or FileBytes.
180func NewVideoUpload(chatID int64, file interface{}) VideoConfig {
181	return VideoConfig{
182		BaseFile: BaseFile{
183			BaseChat:    BaseChat{ChatID: chatID},
184			File:        file,
185			UseExisting: false,
186		},
187	}
188}
189
190// NewVideoShare shares an existing video.
191// You may use this to reshare an existing video without reuploading it.
192//
193// chatID is where to send it, fileID is the ID of the video
194// already uploaded.
195func NewVideoShare(chatID int64, fileID string) VideoConfig {
196	return VideoConfig{
197		BaseFile: BaseFile{
198			BaseChat:    BaseChat{ChatID: chatID},
199			FileID:      fileID,
200			UseExisting: true,
201		},
202	}
203}
204
205// NewAnimationUpload creates a new animation uploader.
206//
207// chatID is where to send it, file is a string path to the file,
208// FileReader, or FileBytes.
209func NewAnimationUpload(chatID int64, file interface{}) AnimationConfig {
210	return AnimationConfig{
211		BaseFile: BaseFile{
212			BaseChat:    BaseChat{ChatID: chatID},
213			File:        file,
214			UseExisting: false,
215		},
216	}
217}
218
219// NewAnimationShare shares an existing animation.
220// You may use this to reshare an existing animation without reuploading it.
221//
222// chatID is where to send it, fileID is the ID of the animation
223// already uploaded.
224func NewAnimationShare(chatID int64, fileID string) AnimationConfig {
225	return AnimationConfig{
226		BaseFile: BaseFile{
227			BaseChat:    BaseChat{ChatID: chatID},
228			FileID:      fileID,
229			UseExisting: true,
230		},
231	}
232}
233
234// NewVideoNoteUpload creates a new video note uploader.
235//
236// chatID is where to send it, file is a string path to the file,
237// FileReader, or FileBytes.
238func NewVideoNoteUpload(chatID int64, length int, file interface{}) VideoNoteConfig {
239	return VideoNoteConfig{
240		BaseFile: BaseFile{
241			BaseChat:    BaseChat{ChatID: chatID},
242			File:        file,
243			UseExisting: false,
244		},
245		Length: length,
246	}
247}
248
249// NewVideoNoteShare shares an existing video.
250// You may use this to reshare an existing video without reuploading it.
251//
252// chatID is where to send it, fileID is the ID of the video
253// already uploaded.
254func NewVideoNoteShare(chatID int64, length int, fileID string) VideoNoteConfig {
255	return VideoNoteConfig{
256		BaseFile: BaseFile{
257			BaseChat:    BaseChat{ChatID: chatID},
258			FileID:      fileID,
259			UseExisting: true,
260		},
261		Length: length,
262	}
263}
264
265// NewVoiceUpload creates a new voice uploader.
266//
267// chatID is where to send it, file is a string path to the file,
268// FileReader, or FileBytes.
269func NewVoiceUpload(chatID int64, file interface{}) VoiceConfig {
270	return VoiceConfig{
271		BaseFile: BaseFile{
272			BaseChat:    BaseChat{ChatID: chatID},
273			File:        file,
274			UseExisting: false,
275		},
276	}
277}
278
279// NewVoiceShare shares an existing voice.
280// You may use this to reshare an existing voice without reuploading it.
281//
282// chatID is where to send it, fileID is the ID of the video
283// already uploaded.
284func NewVoiceShare(chatID int64, fileID string) VoiceConfig {
285	return VoiceConfig{
286		BaseFile: BaseFile{
287			BaseChat:    BaseChat{ChatID: chatID},
288			FileID:      fileID,
289			UseExisting: true,
290		},
291	}
292}
293
294// NewMediaGroup creates a new media group. Files should be an array of
295// two to ten InputMediaPhoto or InputMediaVideo.
296func NewMediaGroup(chatID int64, files []interface{}) MediaGroupConfig {
297	return MediaGroupConfig{
298		BaseChat: BaseChat{
299			ChatID: chatID,
300		},
301		InputMedia: files,
302	}
303}
304
305// NewInputMediaPhoto creates a new InputMediaPhoto.
306func NewInputMediaPhoto(media string) InputMediaPhoto {
307	return InputMediaPhoto{
308		Type:  "photo",
309		Media: media,
310	}
311}
312
313// NewInputMediaVideo creates a new InputMediaVideo.
314func NewInputMediaVideo(media string) InputMediaVideo {
315	return InputMediaVideo{
316		Type:  "video",
317		Media: media,
318	}
319}
320
321// NewContact allows you to send a shared contact.
322func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {
323	return ContactConfig{
324		BaseChat: BaseChat{
325			ChatID: chatID,
326		},
327		PhoneNumber: phoneNumber,
328		FirstName:   firstName,
329	}
330}
331
332// NewLocation shares your location.
333//
334// chatID is where to send it, latitude and longitude are coordinates.
335func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig {
336	return LocationConfig{
337		BaseChat: BaseChat{
338			ChatID: chatID,
339		},
340		Latitude:  latitude,
341		Longitude: longitude,
342	}
343}
344
345// NewVenue allows you to send a venue and its location.
346func NewVenue(chatID int64, title, address string, latitude, longitude float64) VenueConfig {
347	return VenueConfig{
348		BaseChat: BaseChat{
349			ChatID: chatID,
350		},
351		Title:     title,
352		Address:   address,
353		Latitude:  latitude,
354		Longitude: longitude,
355	}
356}
357
358// NewChatAction sets a chat action.
359// Actions last for 5 seconds, or until your next action.
360//
361// chatID is where to send it, action should be set via Chat constants.
362func NewChatAction(chatID int64, action string) ChatActionConfig {
363	return ChatActionConfig{
364		BaseChat: BaseChat{ChatID: chatID},
365		Action:   action,
366	}
367}
368
369// NewUserProfilePhotos gets user profile photos.
370//
371// userID is the ID of the user you wish to get profile photos from.
372func NewUserProfilePhotos(userID int) UserProfilePhotosConfig {
373	return UserProfilePhotosConfig{
374		UserID: userID,
375		Offset: 0,
376		Limit:  0,
377	}
378}
379
380// NewUpdate gets updates since the last Offset.
381//
382// offset is the last Update ID to include.
383// You likely want to set this to the last Update ID plus 1.
384func NewUpdate(offset int) UpdateConfig {
385	return UpdateConfig{
386		Offset:  offset,
387		Limit:   0,
388		Timeout: 0,
389	}
390}
391
392// NewWebhook creates a new webhook.
393//
394// link is the url parsable link you wish to get the updates.
395func NewWebhook(link string) WebhookConfig {
396	u, _ := url.Parse(link)
397
398	return WebhookConfig{
399		URL: u,
400	}
401}
402
403// NewWebhookWithCert creates a new webhook with a certificate.
404//
405// link is the url you wish to get webhooks,
406// file contains a string to a file, FileReader, or FileBytes.
407func NewWebhookWithCert(link string, file interface{}) WebhookConfig {
408	u, _ := url.Parse(link)
409
410	return WebhookConfig{
411		URL:         u,
412		Certificate: file,
413	}
414}
415
416// NewInlineQueryResultArticle creates a new inline query article.
417func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle {
418	return InlineQueryResultArticle{
419		Type:  "article",
420		ID:    id,
421		Title: title,
422		InputMessageContent: InputTextMessageContent{
423			Text: messageText,
424		},
425	}
426}
427
428// NewInlineQueryResultArticleMarkdown creates a new inline query article with Markdown parsing.
429func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle {
430	return InlineQueryResultArticle{
431		Type:  "article",
432		ID:    id,
433		Title: title,
434		InputMessageContent: InputTextMessageContent{
435			Text:      messageText,
436			ParseMode: "Markdown",
437		},
438	}
439}
440
441// NewInlineQueryResultArticleHTML creates a new inline query article with HTML parsing.
442func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle {
443	return InlineQueryResultArticle{
444		Type:  "article",
445		ID:    id,
446		Title: title,
447		InputMessageContent: InputTextMessageContent{
448			Text:      messageText,
449			ParseMode: "HTML",
450		},
451	}
452}
453
454// NewInlineQueryResultGIF creates a new inline query GIF.
455func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF {
456	return InlineQueryResultGIF{
457		Type: "gif",
458		ID:   id,
459		URL:  url,
460	}
461}
462
463// NewInlineQueryResultCachedGIF create a new inline query with cached photo.
464func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF {
465	return InlineQueryResultCachedGIF{
466		Type:  "gif",
467		ID:    id,
468		GifID: gifID,
469	}
470}
471
472// NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
473func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {
474	return InlineQueryResultMPEG4GIF{
475		Type: "mpeg4_gif",
476		ID:   id,
477		URL:  url,
478	}
479}
480
481// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
482func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GifID string) InlineQueryResultCachedMpeg4Gif {
483	return InlineQueryResultCachedMpeg4Gif{
484		Type:   "mpeg4_gif",
485		ID:     id,
486		MGifID: MPEG4GifID,
487	}
488}
489
490// NewInlineQueryResultPhoto creates a new inline query photo.
491func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
492	return InlineQueryResultPhoto{
493		Type: "photo",
494		ID:   id,
495		URL:  url,
496	}
497}
498
499// NewInlineQueryResultPhotoWithThumb creates a new inline query photo.
500func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto {
501	return InlineQueryResultPhoto{
502		Type:     "photo",
503		ID:       id,
504		URL:      url,
505		ThumbURL: thumb,
506	}
507}
508
509// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
510func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto {
511	return InlineQueryResultCachedPhoto{
512		Type:    "photo",
513		ID:      id,
514		PhotoID: photoID,
515	}
516}
517
518// NewInlineQueryResultVideo creates a new inline query video.
519func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
520	return InlineQueryResultVideo{
521		Type: "video",
522		ID:   id,
523		URL:  url,
524	}
525}
526
527// NewInlineQueryResultCachedVideo create a new inline query with cached video.
528func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo {
529	return InlineQueryResultCachedVideo{
530		Type:    "video",
531		ID:      id,
532		VideoID: videoID,
533		Title:   title,
534	}
535}
536
537// NewInlineQueryResultAudio creates a new inline query audio.
538func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {
539	return InlineQueryResultAudio{
540		Type:  "audio",
541		ID:    id,
542		URL:   url,
543		Title: title,
544	}
545}
546
547// NewInlineQueryResultCachedAudio create a new inline query with cached photo.
548func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio {
549	return InlineQueryResultCachedAudio{
550		Type:    "audio",
551		ID:      id,
552		AudioID: audioID,
553	}
554}
555
556// NewInlineQueryResultVoice creates a new inline query voice.
557func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {
558	return InlineQueryResultVoice{
559		Type:  "voice",
560		ID:    id,
561		URL:   url,
562		Title: title,
563	}
564}
565
566// NewInlineQueryResultCachedVoice create a new inline query with cached photo.
567func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice {
568	return InlineQueryResultCachedVoice{
569		Type:    "voice",
570		ID:      id,
571		VoiceID: voiceID,
572		Title:   title,
573	}
574}
575
576// NewInlineQueryResultDocument creates a new inline query document.
577func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {
578	return InlineQueryResultDocument{
579		Type:     "document",
580		ID:       id,
581		URL:      url,
582		Title:    title,
583		MimeType: mimeType,
584	}
585}
586
587// NewInlineQueryResultCachedDocument create a new inline query with cached photo.
588func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument {
589	return InlineQueryResultCachedDocument{
590		Type:       "document",
591		ID:         id,
592		DocumentID: documentID,
593		Title:      title,
594	}
595}
596
597// NewInlineQueryResultLocation creates a new inline query location.
598func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {
599	return InlineQueryResultLocation{
600		Type:      "location",
601		ID:        id,
602		Title:     title,
603		Latitude:  latitude,
604		Longitude: longitude,
605	}
606}
607
608// NewEditMessageText allows you to edit the text of a message.
609func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig {
610	return EditMessageTextConfig{
611		BaseEdit: BaseEdit{
612			ChatID:    chatID,
613			MessageID: messageID,
614		},
615		Text: text,
616	}
617}
618
619// NewEditMessageCaption allows you to edit the caption of a message.
620func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig {
621	return EditMessageCaptionConfig{
622		BaseEdit: BaseEdit{
623			ChatID:    chatID,
624			MessageID: messageID,
625		},
626		Caption:   caption,
627	}
628}
629
630// NewEditMessageReplyMarkup allows you to edit the inline
631// keyboard markup.
632func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig {
633	return EditMessageReplyMarkupConfig{
634		BaseEdit: BaseEdit{
635			ChatID:      chatID,
636			MessageID:   messageID,
637			ReplyMarkup: &replyMarkup,
638		},
639	}
640}
641
642// NewHideKeyboard hides the keyboard, with the option for being selective
643// or hiding for everyone.
644func NewHideKeyboard(selective bool) ReplyKeyboardHide {
645	log.Println("NewHideKeyboard is deprecated, please use NewRemoveKeyboard")
646
647	return ReplyKeyboardHide{
648		HideKeyboard: true,
649		Selective:    selective,
650	}
651}
652
653// NewRemoveKeyboard hides the keyboard, with the option for being selective
654// or hiding for everyone.
655func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove {
656	return ReplyKeyboardRemove{
657		RemoveKeyboard: true,
658		Selective:      selective,
659	}
660}
661
662// NewKeyboardButton creates a regular keyboard button.
663func NewKeyboardButton(text string) KeyboardButton {
664	return KeyboardButton{
665		Text: text,
666	}
667}
668
669// NewKeyboardButtonContact creates a keyboard button that requests
670// user contact information upon click.
671func NewKeyboardButtonContact(text string) KeyboardButton {
672	return KeyboardButton{
673		Text:           text,
674		RequestContact: true,
675	}
676}
677
678// NewKeyboardButtonLocation creates a keyboard button that requests
679// user location information upon click.
680func NewKeyboardButtonLocation(text string) KeyboardButton {
681	return KeyboardButton{
682		Text:            text,
683		RequestLocation: true,
684	}
685}
686
687// NewKeyboardButtonRow creates a row of keyboard buttons.
688func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton {
689	var row []KeyboardButton
690
691	row = append(row, buttons...)
692
693	return row
694}
695
696// NewReplyKeyboard creates a new regular keyboard with sane defaults.
697func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {
698	var keyboard [][]KeyboardButton
699
700	keyboard = append(keyboard, rows...)
701
702	return ReplyKeyboardMarkup{
703		ResizeKeyboard: true,
704		Keyboard:       keyboard,
705	}
706}
707
708// NewInlineKeyboardButtonData creates an inline keyboard button with text
709// and data for a callback.
710func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {
711	return InlineKeyboardButton{
712		Text:         text,
713		CallbackData: &data,
714	}
715}
716
717// NewInlineKeyboardButtonURL creates an inline keyboard button with text
718// which goes to a URL.
719func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {
720	return InlineKeyboardButton{
721		Text: text,
722		URL:  &url,
723	}
724}
725
726// NewInlineKeyboardButtonSwitch creates an inline keyboard button with
727// text which allows the user to switch to a chat or return to a chat.
728func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton {
729	return InlineKeyboardButton{
730		Text:              text,
731		SwitchInlineQuery: &sw,
732	}
733}
734
735// NewInlineKeyboardRow creates an inline keyboard row with buttons.
736func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton {
737	var row []InlineKeyboardButton
738
739	row = append(row, buttons...)
740
741	return row
742}
743
744// NewInlineKeyboardMarkup creates a new inline keyboard.
745func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup {
746	var keyboard [][]InlineKeyboardButton
747
748	keyboard = append(keyboard, rows...)
749
750	return InlineKeyboardMarkup{
751		InlineKeyboard: keyboard,
752	}
753}
754
755// NewCallback creates a new callback message.
756func NewCallback(id, text string) CallbackConfig {
757	return CallbackConfig{
758		CallbackQueryID: id,
759		Text:            text,
760		ShowAlert:       false,
761	}
762}
763
764// NewCallbackWithAlert creates a new callback message that alerts
765// the user.
766func NewCallbackWithAlert(id, text string) CallbackConfig {
767	return CallbackConfig{
768		CallbackQueryID: id,
769		Text:            text,
770		ShowAlert:       true,
771	}
772}
773
774// NewInvoice creates a new Invoice request to the user.
775func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices *[]LabeledPrice) InvoiceConfig {
776	return InvoiceConfig{
777		BaseChat:       BaseChat{ChatID: chatID},
778		Title:          title,
779		Description:    description,
780		Payload:        payload,
781		ProviderToken:  providerToken,
782		StartParameter: startParameter,
783		Currency:       currency,
784		Prices:         prices}
785}
786
787// NewSetChatPhotoUpload creates a new chat photo uploader.
788//
789// chatID is where to send it, file is a string path to the file,
790// FileReader, or FileBytes.
791//
792// Note that you must send animated GIFs as a document.
793func NewSetChatPhotoUpload(chatID int64, file interface{}) SetChatPhotoConfig {
794	return SetChatPhotoConfig{
795		BaseFile: BaseFile{
796			BaseChat:    BaseChat{ChatID: chatID},
797			File:        file,
798			UseExisting: false,
799		},
800	}
801}
802
803// NewSetChatPhotoShare shares an existing photo.
804// You may use this to reshare an existing photo without reuploading it.
805//
806// chatID is where to send it, fileID is the ID of the file
807// already uploaded.
808func NewSetChatPhotoShare(chatID int64, fileID string) SetChatPhotoConfig {
809	return SetChatPhotoConfig{
810		BaseFile: BaseFile{
811			BaseChat:    BaseChat{ChatID: chatID},
812			FileID:      fileID,
813			UseExisting: true,
814		},
815	}
816}