Documentation ¶
Overview ¶
Package markup contain bots inline markup builder.
Index ¶
- func Button(text string) *tg.KeyboardButton
- func Buy(text string) *tg.KeyboardButtonBuy
- func Callback(text string, data []byte) *tg.KeyboardButtonCallback
- func ForceReply(singleUse, selective bool) tg.ReplyMarkupClass
- func Game(text string) *tg.KeyboardButtonGame
- func Hide() tg.ReplyMarkupClass
- func InlineKeyboard(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
- func InlineRow(buttons ...tg.KeyboardButtonClass) tg.ReplyMarkupClass
- func InputURLAuth(requestWriteAccess bool, text, fwdText, url string, bot tg.InputUserClass) *tg.InputKeyboardButtonURLAuth
- func InputUserProfile(text string, user tg.InputUserClass) *tg.InputKeyboardButtonUserProfile
- func Keyboard(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
- func RequestGeoLocation(text string) *tg.KeyboardButtonRequestGeoLocation
- func RequestPeer(text string, buttonID int, peerType tg.RequestPeerTypeClass) *tg.KeyboardButtonRequestPeer
- func RequestPhone(text string) *tg.KeyboardButtonRequestPhone
- func RequestPoll(text string, quiz bool) *tg.KeyboardButtonRequestPoll
- func Row(buttons ...tg.KeyboardButtonClass) tg.KeyboardButtonRow
- func SelectiveHide() tg.ReplyMarkupClass
- func SimpleWebView(text, url string) *tg.KeyboardButtonSimpleWebView
- func SingleRow(buttons ...tg.KeyboardButtonClass) tg.ReplyMarkupClass
- func SwitchInline(text, query string, samePeer bool) *tg.KeyboardButtonSwitchInline
- func URL(text, url string) *tg.KeyboardButtonURL
- func URLAuth(text, url string, buttonID int, fwdText string) *tg.KeyboardButtonURLAuth
- func UserProfile(text string, userID int64) *tg.KeyboardButtonUserProfile
- func WebView(text, url string) *tg.KeyboardButtonWebView
- type ReplyKeyboardMarkupBuilder
- func (b *ReplyKeyboardMarkupBuilder) Build(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
- func (b *ReplyKeyboardMarkupBuilder) Resize() *ReplyKeyboardMarkupBuilder
- func (b *ReplyKeyboardMarkupBuilder) Selective() *ReplyKeyboardMarkupBuilder
- func (b *ReplyKeyboardMarkupBuilder) SingleUse() *ReplyKeyboardMarkupBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Callback ¶
func Callback(text string, data []byte) *tg.KeyboardButtonCallback
Callback creates new callback button.
func ForceReply ¶
func ForceReply(singleUse, selective bool) tg.ReplyMarkupClass
ForceReply creates markup to force the user to send a reply.
func InlineKeyboard ¶
func InlineKeyboard(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
InlineKeyboard creates inline keyboard using given rows.
func InlineRow ¶
func InlineRow(buttons ...tg.KeyboardButtonClass) tg.ReplyMarkupClass
InlineRow creates inline keyboard with single row using given buttons.
func InputURLAuth ¶
func InputURLAuth(requestWriteAccess bool, text, fwdText, url string, bot tg.InputUserClass) *tg.InputKeyboardButtonURLAuth
InputURLAuth creates button to request a user to authorize via URL using Seamless Telegram Login. Can only be sent or received as part of an inline keyboard, use URLAuth for reply keyboards.
func InputUserProfile ¶
func InputUserProfile(text string, user tg.InputUserClass) *tg.InputKeyboardButtonUserProfile
InputUserProfile creates button that links directly to a user profile. Can only be sent or received as part of an inline keyboard, use UserProfile for reply keyboards.
func Keyboard ¶
func Keyboard(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
Keyboard creates keyboard using given rows.
func RequestGeoLocation ¶
func RequestGeoLocation(text string) *tg.KeyboardButtonRequestGeoLocation
RequestGeoLocation creates button to request a user's geo location.
func RequestPeer ¶
func RequestPeer(text string, buttonID int, peerType tg.RequestPeerTypeClass) *tg.KeyboardButtonRequestPeer
RequestPeer creates button that prompts the user to select and share a peer with the bot using messages.sendBotRequestedPeer.
func RequestPhone ¶
func RequestPhone(text string) *tg.KeyboardButtonRequestPhone
RequestPhone creates button to request a user's phone number.
func RequestPoll ¶
func RequestPoll(text string, quiz bool) *tg.KeyboardButtonRequestPoll
RequestPoll creates button that allows the user to create and send a poll when pressed. Available only in private.
func Row ¶
func Row(buttons ...tg.KeyboardButtonClass) tg.KeyboardButtonRow
Row creates keyboard row.
func SelectiveHide ¶
func SelectiveHide() tg.ReplyMarkupClass
SelectiveHide creates markup to hide markup. Use this builder if you want to remove the keyboard for specific users only. Targets:
- users that are @mentioned in the text of the Message object;
- if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
func SimpleWebView ¶
func SimpleWebView(text, url string) *tg.KeyboardButtonSimpleWebView
SimpleWebView creates button to open a bot web app using messages.requestSimpleWebView, without sending user information to the web app. Can only be sent or received as part of a reply keyboard, use WebView for inline keyboards.
func SingleRow ¶
func SingleRow(buttons ...tg.KeyboardButtonClass) tg.ReplyMarkupClass
SingleRow creates keyboard with single row using given buttons.
func SwitchInline ¶
func SwitchInline(text, query string, samePeer bool) *tg.KeyboardButtonSwitchInline
SwitchInline creates button to force a user to switch to inline mode. Pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field.
If samePeer set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field.
func URLAuth ¶
func URLAuth(text, url string, buttonID int, fwdText string) *tg.KeyboardButtonURLAuth
URLAuth creates button to request a user to authorize via URL using Seamless Telegram Login. Can only be sent or received as part of a reply keyboard, use InputURLAuth for inline keyboards.
func UserProfile ¶
func UserProfile(text string, userID int64) *tg.KeyboardButtonUserProfile
UserProfile creates button that links directly to a user profile. Can only be sent or received as part of a reply keyboard, use InputUserProfile for inline keyboards.
func WebView ¶
func WebView(text, url string) *tg.KeyboardButtonWebView
WebView creates button to open a bot web app using messages.requestWebView, sending over user information after user confirmation. Can only be sent or received as part of an inline keyboard, use SimpleWebView for reply keyboards.
Types ¶
type ReplyKeyboardMarkupBuilder ¶
type ReplyKeyboardMarkupBuilder struct {
// contains filtered or unexported fields
}
ReplyKeyboardMarkupBuilder is a keyboard markup builder.
func BuildKeyboard ¶
func BuildKeyboard() *ReplyKeyboardMarkupBuilder
BuildKeyboard creates keyboard builder.
func (*ReplyKeyboardMarkupBuilder) Build ¶
func (b *ReplyKeyboardMarkupBuilder) Build(rows ...tg.KeyboardButtonRow, ) tg.ReplyMarkupClass
Build returns created keyboard.
func (*ReplyKeyboardMarkupBuilder) Resize ¶
func (b *ReplyKeyboardMarkupBuilder) Resize() *ReplyKeyboardMarkupBuilder
Resize sets flag to request clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). If not set, the custom keyboard is always of the same height as the app's standard keyboard.
func (*ReplyKeyboardMarkupBuilder) Selective ¶
func (b *ReplyKeyboardMarkupBuilder) Selective() *ReplyKeyboardMarkupBuilder
Selective sets flag to show the keyboard to specific users only. Targets:
- users that are @mentioned in the text of the Message object;
- if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
func (*ReplyKeyboardMarkupBuilder) SingleUse ¶
func (b *ReplyKeyboardMarkupBuilder) SingleUse() *ReplyKeyboardMarkupBuilder
SingleUse sets flag to request clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again.