all repos — telegram-bot-api @ daa1ed199c5a3f6124aa023e9a006fa575befd64

Golang bindings for the Telegram Bot API

NewInlineKeyboardButtonWebApp & NewKeyboardButtonWebApp added
n git@rini.moscow
Wed, 18 May 2022 17:45:52 +0300
commit

daa1ed199c5a3f6124aa023e9a006fa575befd64

parent

537c005643adee10686fa7d9bb860dec33a535d4

1 files changed, 18 insertions(+), 0 deletions(-)

jump to
M helpers.gohelpers.go

@@ -618,6 +618,15 @@ Text: text,

} } +// NewKeyboardButtonWebApp creates a keyboard button with text +// which goes to a WebApp. +func NewKeyboardButtonWebApp(text string, webapp WebAppInfo) KeyboardButton { + return KeyboardButton{ + Text: text, + WebApp: &webapp, + } +} + // NewKeyboardButtonContact creates a keyboard button that requests // user contact information upon click. func NewKeyboardButtonContact(text string) KeyboardButton {

@@ -670,6 +679,15 @@ func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {

return InlineKeyboardButton{ Text: text, CallbackData: &data, + } +} + +// NewInlineKeyboardButtonWebApp creates an inline keyboard button with text +// which goes to a WebApp. +func NewInlineKeyboardButtonWebApp(text string, webapp WebAppInfo) InlineKeyboardButton { + return InlineKeyboardButton{ + Text: text, + WebApp: &webapp, } }