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