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 Keyboard(rows ...tg.KeyboardButtonRow) tg.ReplyMarkupClass
- func RequestGeoLocation(text string) *tg.KeyboardButtonRequestGeoLocation
- 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 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
- 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 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 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 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.
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.