all repos — telegram-bot-api @ 00ae0202053389c6ad3932d730e3f9fcdcace649

Golang bindings for the Telegram Bot API

Merge pull request #554 from nickRiNi/master

NewInlineKeyboardButtonWebApp & NewKeyboardButtonWebApp added
Syfaro syfaro@huefox.com
Wed, 19 Oct 2022 20:31:40 -0400
commit

00ae0202053389c6ad3932d730e3f9fcdcace649

parent

99503a71186fd705a373057423621da02db2703e

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, } }