all repos — telegram-bot-api @ aaaa278b563e4e344a0e9440591347371801f2f1

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