all repos — telegram-bot-api @ 0a6e349f52da30c8ccda45fb2b9ec625c8ef63b7

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// 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 {
 60	return CopyMessageConfig{
 61		BaseChat:   BaseChat{ChatID: chatID},
 62		FromChatID: fromChatID,
 63		MessageID:  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 interface{}) PhotoConfig {
 74	return PhotoConfig{
 75		BaseFile: BaseFile{
 76			BaseChat: BaseChat{ChatID: chatID},
 77			File:     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 interface{}) PhotoConfig {
 86	return PhotoConfig{
 87		BaseFile: BaseFile{
 88			BaseChat: BaseChat{
 89				ChannelUsername: username,
 90			},
 91			File: file,
 92		},
 93	}
 94}
 95
 96// NewAudio creates a new sendAudio request.
 97func NewAudio(chatID int64, file interface{}) AudioConfig {
 98	return AudioConfig{
 99		BaseFile: BaseFile{
100			BaseChat: BaseChat{ChatID: chatID},
101			File:     file,
102		},
103	}
104}
105
106// NewDocument creates a new sendDocument request.
107func NewDocument(chatID int64, file interface{}) DocumentConfig {
108	return DocumentConfig{
109		BaseFile: BaseFile{
110			BaseChat: BaseChat{ChatID: chatID},
111			File:     file,
112		},
113	}
114}
115
116// NewSticker creates a new sendSticker request.
117func NewSticker(chatID int64, file interface{}) StickerConfig {
118	return StickerConfig{
119		BaseFile: BaseFile{
120			BaseChat: BaseChat{ChatID: chatID},
121			File:     file,
122		},
123	}
124}
125
126// NewVideo creates a new sendVideo request.
127func NewVideo(chatID int64, file interface{}) VideoConfig {
128	return VideoConfig{
129		BaseFile: BaseFile{
130			BaseChat: BaseChat{ChatID: chatID},
131			File:     file,
132		},
133	}
134}
135
136// NewAnimation creates a new sendAnimation request.
137func NewAnimation(chatID int64, file interface{}) AnimationConfig {
138	return AnimationConfig{
139		BaseFile: BaseFile{
140			BaseChat: BaseChat{ChatID: chatID},
141			File:     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 interface{}) VideoNoteConfig {
151	return VideoNoteConfig{
152		BaseFile: BaseFile{
153			BaseChat: BaseChat{ChatID: chatID},
154			File:     file,
155		},
156		Length: length,
157	}
158}
159
160// NewVoice creates a new sendVoice request.
161func NewVoice(chatID int64, file interface{}) VoiceConfig {
162	return VoiceConfig{
163		BaseFile: BaseFile{
164			BaseChat: BaseChat{ChatID: chatID},
165			File:     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 {
173	return MediaGroupConfig{
174		ChatID: chatID,
175		Media:  files,
176	}
177}
178
179// NewInputMediaPhoto creates a new InputMediaPhoto.
180func NewInputMediaPhoto(media interface{}) InputMediaPhoto {
181	return InputMediaPhoto{
182		BaseInputMedia{
183			Type:  "photo",
184			Media: media,
185		},
186	}
187}
188
189// NewInputMediaVideo creates a new InputMediaVideo.
190func NewInputMediaVideo(media interface{}) InputMediaVideo {
191	return InputMediaVideo{
192		BaseInputMedia: BaseInputMedia{
193			Type:  "video",
194			Media: media,
195		},
196	}
197}
198
199// NewInputMediaAnimation creates a new InputMediaAnimation.
200func NewInputMediaAnimation(media interface{}) InputMediaAnimation {
201	return InputMediaAnimation{
202		BaseInputMedia: BaseInputMedia{
203			Type:  "animation",
204			Media: media,
205		},
206	}
207}
208
209// NewInputMediaAudio creates a new InputMediaAudio.
210func NewInputMediaAudio(media interface{}) InputMediaAudio {
211	return InputMediaAudio{
212		BaseInputMedia: BaseInputMedia{
213			Type:  "audio",
214			Media: media,
215		},
216	}
217}
218
219// NewInputMediaDocument creates a new InputMediaDocument.
220func NewInputMediaDocument(media interface{}) InputMediaDocument {
221	return InputMediaDocument{
222		BaseInputMedia: BaseInputMedia{
223			Type:  "document",
224			Media: media,
225		},
226	}
227}
228
229// NewContact allows you to send a shared contact.
230func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {
231	return ContactConfig{
232		BaseChat: BaseChat{
233			ChatID: chatID,
234		},
235		PhoneNumber: phoneNumber,
236		FirstName:   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 {
244	return LocationConfig{
245		BaseChat: BaseChat{
246			ChatID: chatID,
247		},
248		Latitude:  latitude,
249		Longitude: 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 {
255	return VenueConfig{
256		BaseChat: BaseChat{
257			ChatID: chatID,
258		},
259		Title:     title,
260		Address:   address,
261		Latitude:  latitude,
262		Longitude: 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 {
271	return ChatActionConfig{
272		BaseChat: BaseChat{ChatID: chatID},
273		Action:   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 {
281	return UserProfilePhotosConfig{
282		UserID: userID,
283		Offset: 0,
284		Limit:  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 {
293	return UpdateConfig{
294		Offset:  offset,
295		Limit:   0,
296		Timeout: 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 {
304	u, _ := url.Parse(link)
305
306	return WebhookConfig{
307		URL: u,
308	}
309}
310
311// NewWebhookWithCert creates a new webhook with a certificate.
312//
313// link is the url you wish to get webhooks,
314// file contains a string to a file, FileReader, or FileBytes.
315func NewWebhookWithCert(link string, file interface{}) WebhookConfig {
316	u, _ := url.Parse(link)
317
318	return WebhookConfig{
319		URL:         u,
320		Certificate: file,
321	}
322}
323
324// NewInlineQueryResultArticle creates a new inline query article.
325func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle {
326	return InlineQueryResultArticle{
327		Type:  "article",
328		ID:    id,
329		Title: title,
330		InputMessageContent: InputTextMessageContent{
331			Text: messageText,
332		},
333	}
334}
335
336// NewInlineQueryResultArticleMarkdown creates a new inline query article with Markdown parsing.
337func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle {
338	return InlineQueryResultArticle{
339		Type:  "article",
340		ID:    id,
341		Title: title,
342		InputMessageContent: InputTextMessageContent{
343			Text:      messageText,
344			ParseMode: "Markdown",
345		},
346	}
347}
348
349// NewInlineQueryResultArticleMarkdownV2 creates a new inline query article with MarkdownV2 parsing.
350func NewInlineQueryResultArticleMarkdownV2(id, title, messageText string) InlineQueryResultArticle {
351	return InlineQueryResultArticle{
352		Type:  "article",
353		ID:    id,
354		Title: title,
355		InputMessageContent: InputTextMessageContent{
356			Text:      messageText,
357			ParseMode: "MarkdownV2",
358		},
359	}
360}
361
362// NewInlineQueryResultArticleHTML creates a new inline query article with HTML parsing.
363func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle {
364	return InlineQueryResultArticle{
365		Type:  "article",
366		ID:    id,
367		Title: title,
368		InputMessageContent: InputTextMessageContent{
369			Text:      messageText,
370			ParseMode: "HTML",
371		},
372	}
373}
374
375// NewInlineQueryResultGIF creates a new inline query GIF.
376func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF {
377	return InlineQueryResultGIF{
378		Type: "gif",
379		ID:   id,
380		URL:  url,
381	}
382}
383
384// NewInlineQueryResultCachedGIF create a new inline query with cached photo.
385func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF {
386	return InlineQueryResultCachedGIF{
387		Type:  "gif",
388		ID:    id,
389		GIFID: gifID,
390	}
391}
392
393// NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
394func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {
395	return InlineQueryResultMPEG4GIF{
396		Type: "mpeg4_gif",
397		ID:   id,
398		URL:  url,
399	}
400}
401
402// NewInlineQueryResultCachedMPEG4GIF create a new inline query with cached MPEG4 GIF.
403func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GIFID string) InlineQueryResultCachedMPEG4GIF {
404	return InlineQueryResultCachedMPEG4GIF{
405		Type:        "mpeg4_gif",
406		ID:          id,
407		MPEG4FileID: MPEG4GIFID,
408	}
409}
410
411// NewInlineQueryResultPhoto creates a new inline query photo.
412func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
413	return InlineQueryResultPhoto{
414		Type: "photo",
415		ID:   id,
416		URL:  url,
417	}
418}
419
420// NewInlineQueryResultPhotoWithThumb creates a new inline query photo.
421func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto {
422	return InlineQueryResultPhoto{
423		Type:     "photo",
424		ID:       id,
425		URL:      url,
426		ThumbURL: thumb,
427	}
428}
429
430// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
431func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto {
432	return InlineQueryResultCachedPhoto{
433		Type:    "photo",
434		ID:      id,
435		PhotoID: photoID,
436	}
437}
438
439// NewInlineQueryResultVideo creates a new inline query video.
440func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
441	return InlineQueryResultVideo{
442		Type: "video",
443		ID:   id,
444		URL:  url,
445	}
446}
447
448// NewInlineQueryResultCachedVideo create a new inline query with cached video.
449func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo {
450	return InlineQueryResultCachedVideo{
451		Type:    "video",
452		ID:      id,
453		VideoID: videoID,
454		Title:   title,
455	}
456}
457
458// NewInlineQueryResultCachedSticker create a new inline query with cached sticker.
459func NewInlineQueryResultCachedSticker(id, stickerID, title string) InlineQueryResultCachedSticker {
460	return InlineQueryResultCachedSticker{
461		Type:      "sticker",
462		ID:        id,
463		StickerID: stickerID,
464		Title:     title,
465	}
466}
467
468// NewInlineQueryResultAudio creates a new inline query audio.
469func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {
470	return InlineQueryResultAudio{
471		Type:  "audio",
472		ID:    id,
473		URL:   url,
474		Title: title,
475	}
476}
477
478// NewInlineQueryResultCachedAudio create a new inline query with cached photo.
479func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio {
480	return InlineQueryResultCachedAudio{
481		Type:    "audio",
482		ID:      id,
483		AudioID: audioID,
484	}
485}
486
487// NewInlineQueryResultVoice creates a new inline query voice.
488func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {
489	return InlineQueryResultVoice{
490		Type:  "voice",
491		ID:    id,
492		URL:   url,
493		Title: title,
494	}
495}
496
497// NewInlineQueryResultCachedVoice create a new inline query with cached photo.
498func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice {
499	return InlineQueryResultCachedVoice{
500		Type:    "voice",
501		ID:      id,
502		VoiceID: voiceID,
503		Title:   title,
504	}
505}
506
507// NewInlineQueryResultDocument creates a new inline query document.
508func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {
509	return InlineQueryResultDocument{
510		Type:     "document",
511		ID:       id,
512		URL:      url,
513		Title:    title,
514		MimeType: mimeType,
515	}
516}
517
518// NewInlineQueryResultCachedDocument create a new inline query with cached photo.
519func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument {
520	return InlineQueryResultCachedDocument{
521		Type:       "document",
522		ID:         id,
523		DocumentID: documentID,
524		Title:      title,
525	}
526}
527
528// NewInlineQueryResultLocation creates a new inline query location.
529func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {
530	return InlineQueryResultLocation{
531		Type:      "location",
532		ID:        id,
533		Title:     title,
534		Latitude:  latitude,
535		Longitude: longitude,
536	}
537}
538
539// NewInlineQueryResultVenue creates a new inline query venue.
540func NewInlineQueryResultVenue(id, title, address string, latitude, longitude float64) InlineQueryResultVenue {
541	return InlineQueryResultVenue{
542		Type:      "venue",
543		ID:        id,
544		Title:     title,
545		Address:   address,
546		Latitude:  latitude,
547		Longitude: longitude,
548	}
549}
550
551// NewEditMessageText allows you to edit the text of a message.
552func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig {
553	return EditMessageTextConfig{
554		BaseEdit: BaseEdit{
555			ChatID:    chatID,
556			MessageID: messageID,
557		},
558		Text: text,
559	}
560}
561
562// NewEditMessageTextAndMarkup allows you to edit the text and replymarkup of a message.
563func NewEditMessageTextAndMarkup(chatID int64, messageID int, text string, replyMarkup InlineKeyboardMarkup) EditMessageTextConfig {
564	return EditMessageTextConfig{
565		BaseEdit: BaseEdit{
566			ChatID:      chatID,
567			MessageID:   messageID,
568			ReplyMarkup: &replyMarkup,
569		},
570		Text: text,
571	}
572}
573
574// NewEditMessageCaption allows you to edit the caption of a message.
575func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig {
576	return EditMessageCaptionConfig{
577		BaseEdit: BaseEdit{
578			ChatID:    chatID,
579			MessageID: messageID,
580		},
581		Caption: caption,
582	}
583}
584
585// NewEditMessageReplyMarkup allows you to edit the inline
586// keyboard markup.
587func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig {
588	return EditMessageReplyMarkupConfig{
589		BaseEdit: BaseEdit{
590			ChatID:      chatID,
591			MessageID:   messageID,
592			ReplyMarkup: &replyMarkup,
593		},
594	}
595}
596
597// NewRemoveKeyboard hides the keyboard, with the option for being selective
598// or hiding for everyone.
599func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove {
600	return ReplyKeyboardRemove{
601		RemoveKeyboard: true,
602		Selective:      selective,
603	}
604}
605
606// NewKeyboardButton creates a regular keyboard button.
607func NewKeyboardButton(text string) KeyboardButton {
608	return KeyboardButton{
609		Text: text,
610	}
611}
612
613// NewKeyboardButtonContact creates a keyboard button that requests
614// user contact information upon click.
615func NewKeyboardButtonContact(text string) KeyboardButton {
616	return KeyboardButton{
617		Text:           text,
618		RequestContact: true,
619	}
620}
621
622// NewKeyboardButtonLocation creates a keyboard button that requests
623// user location information upon click.
624func NewKeyboardButtonLocation(text string) KeyboardButton {
625	return KeyboardButton{
626		Text:            text,
627		RequestLocation: true,
628	}
629}
630
631// NewKeyboardButtonRow creates a row of keyboard buttons.
632func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton {
633	var row []KeyboardButton
634
635	row = append(row, buttons...)
636
637	return row
638}
639
640// NewReplyKeyboard creates a new regular keyboard with sane defaults.
641func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {
642	var keyboard [][]KeyboardButton
643
644	keyboard = append(keyboard, rows...)
645
646	return ReplyKeyboardMarkup{
647		ResizeKeyboard: true,
648		Keyboard:       keyboard,
649	}
650}
651
652// NewOneTimeReplyKeyboard creates a new one time keyboard.
653func NewOneTimeReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {
654	markup := NewReplyKeyboard(rows...)
655	markup.OneTimeKeyboard = true
656	return markup
657}
658
659// NewInlineKeyboardButtonData creates an inline keyboard button with text
660// and data for a callback.
661func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {
662	return InlineKeyboardButton{
663		Text:         text,
664		CallbackData: &data,
665	}
666}
667
668// NewInlineKeyboardButtonURL creates an inline keyboard button with text
669// which goes to a URL.
670func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {
671	return InlineKeyboardButton{
672		Text: text,
673		URL:  &url,
674	}
675}
676
677// NewInlineKeyboardButtonSwitch creates an inline keyboard button with
678// text which allows the user to switch to a chat or return to a chat.
679func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton {
680	return InlineKeyboardButton{
681		Text:              text,
682		SwitchInlineQuery: &sw,
683	}
684}
685
686// NewInlineKeyboardRow creates an inline keyboard row with buttons.
687func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton {
688	var row []InlineKeyboardButton
689
690	row = append(row, buttons...)
691
692	return row
693}
694
695// NewInlineKeyboardMarkup creates a new inline keyboard.
696func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup {
697	var keyboard [][]InlineKeyboardButton
698
699	keyboard = append(keyboard, rows...)
700
701	return InlineKeyboardMarkup{
702		InlineKeyboard: keyboard,
703	}
704}
705
706// NewCallback creates a new callback message.
707func NewCallback(id, text string) CallbackConfig {
708	return CallbackConfig{
709		CallbackQueryID: id,
710		Text:            text,
711		ShowAlert:       false,
712	}
713}
714
715// NewCallbackWithAlert creates a new callback message that alerts
716// the user.
717func NewCallbackWithAlert(id, text string) CallbackConfig {
718	return CallbackConfig{
719		CallbackQueryID: id,
720		Text:            text,
721		ShowAlert:       true,
722	}
723}
724
725// NewInvoice creates a new Invoice request to the user.
726func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices []LabeledPrice) InvoiceConfig {
727	return InvoiceConfig{
728		BaseChat:       BaseChat{ChatID: chatID},
729		Title:          title,
730		Description:    description,
731		Payload:        payload,
732		ProviderToken:  providerToken,
733		StartParameter: startParameter,
734		Currency:       currency,
735		Prices:         prices}
736}
737
738// NewChatTitle allows you to update the title of a chat.
739func NewChatTitle(chatID int64, title string) SetChatTitleConfig {
740	return SetChatTitleConfig{
741		ChatID: chatID,
742		Title:  title,
743	}
744}
745
746// NewChatDescription allows you to update the description of a chat.
747func NewChatDescription(chatID int64, description string) SetChatDescriptionConfig {
748	return SetChatDescriptionConfig{
749		ChatID:      chatID,
750		Description: description,
751	}
752}
753
754// NewChatPhoto allows you to update the photo for a chat.
755func NewChatPhoto(chatID int64, photo interface{}) SetChatPhotoConfig {
756	return SetChatPhotoConfig{
757		BaseFile: BaseFile{
758			BaseChat: BaseChat{
759				ChatID: chatID,
760			},
761			File: photo,
762		},
763	}
764}
765
766// NewDeleteChatPhoto allows you to delete the photo for a chat.
767func NewDeleteChatPhoto(chatID int64, photo interface{}) DeleteChatPhotoConfig {
768	return DeleteChatPhotoConfig{
769		ChatID: chatID,
770	}
771}
772
773// NewPoll allows you to create a new poll.
774func NewPoll(chatID int64, question string, options ...string) SendPollConfig {
775	return SendPollConfig{
776		BaseChat: BaseChat{
777			ChatID: chatID,
778		},
779		Question:    question,
780		Options:     options,
781		IsAnonymous: true, // This is Telegram's default.
782	}
783}
784
785// NewStopPoll allows you to stop a poll.
786func NewStopPoll(chatID int64, messageID int) StopPollConfig {
787	return StopPollConfig{
788		BaseEdit{
789			ChatID:    chatID,
790			MessageID: messageID,
791		},
792	}
793}
794
795// NewSendDice allows you to send a random dice roll.
796//
797// Deprecated: Use NewDice instead.
798func NewSendDice(chatID int64) DiceConfig {
799	return NewDice(chatID)
800}
801
802// NewDice allows you to send a random dice roll.
803func NewDice(chatID int64) DiceConfig {
804	return DiceConfig{
805		BaseChat: BaseChat{
806			ChatID: chatID,
807		},
808	}
809}
810
811// NewDiceWithEmoji allows you to send a random roll of one of many types.
812//
813// Emoji may be 🎲 (1-6), 🎯 (1-6), or 🏀 (1-5).
814func NewDiceWithEmoji(chatID int64, emoji string) DiceConfig {
815	return DiceConfig{
816		BaseChat: BaseChat{
817			ChatID: chatID,
818		},
819		Emoji: emoji,
820	}
821}
822
823// NewSetMyCommands allows you to set the registered commands.
824func NewSetMyCommands(commands ...BotCommand) SetMyCommandsConfig {
825	return SetMyCommandsConfig{commands: commands}
826}