Merge pull request #267 from antsupovsa/develop
Add helper for InlineKeyboardButtonLoginURLbot-api-6.1
commit
d0e1dfd8c6
|
@ -673,6 +673,15 @@ func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewInlineKeyboardButtonLoginURL creates an inline keyboard button with text
|
||||||
|
// which goes to a LoginURL.
|
||||||
|
func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton {
|
||||||
|
return InlineKeyboardButton{
|
||||||
|
Text: text,
|
||||||
|
LoginURL: &loginURL,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewInlineKeyboardButtonURL creates an inline keyboard button with text
|
// NewInlineKeyboardButtonURL creates an inline keyboard button with text
|
||||||
// which goes to a URL.
|
// which goes to a URL.
|
||||||
func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {
|
func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {
|
||||||
|
|
|
@ -161,6 +161,23 @@ func TestNewInlineQueryResultLocation(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewInlineKeyboardButtonLoginURL(t *testing.T) {
|
||||||
|
result := NewInlineKeyboardButtonLoginURL("text", LoginURL{
|
||||||
|
URL: "url",
|
||||||
|
ForwardText: "ForwardText",
|
||||||
|
BotUsername: "username",
|
||||||
|
RequestWriteAccess: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
if result.Text != "text" ||
|
||||||
|
result.LoginURL.URL != "url" ||
|
||||||
|
result.LoginURL.ForwardText != "ForwardText" ||
|
||||||
|
result.LoginURL.BotUsername != "username" ||
|
||||||
|
result.LoginURL.RequestWriteAccess != false {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestNewEditMessageText(t *testing.T) {
|
func TestNewEditMessageText(t *testing.T) {
|
||||||
edit := NewEditMessageText(ChatID, ReplyToMessageID, "new text")
|
edit := NewEditMessageText(ChatID, ReplyToMessageID, "new text")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue