fix: fixed Url to URL to fit the standartization.
This commit is contained in:
parent
2d5acbd112
commit
7a9a8be397
2 changed files with 6 additions and 6 deletions
10
button.go
10
button.go
|
@ -11,7 +11,7 @@ import (
|
||||||
type Button struct {
|
type Button struct {
|
||||||
Text string
|
Text string
|
||||||
Data string
|
Data string
|
||||||
Url string
|
URL string
|
||||||
SendLocation bool
|
SendLocation bool
|
||||||
Action Action
|
Action Action
|
||||||
// Used to skip buttons in generating by functions.
|
// Used to skip buttons in generating by functions.
|
||||||
|
@ -55,8 +55,8 @@ func (btn Button) Rand() Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the URL for the button. Only for inline buttons.
|
// Set the URL for the button. Only for inline buttons.
|
||||||
func (btn Button) WithUrl(format string, v ...any) Button {
|
func (btn Button) WithURL(format string, v ...any) Button {
|
||||||
btn.Url = fmt.Sprintf(format, v...)
|
btn.URL = fmt.Sprintf(format, v...)
|
||||||
return btn
|
return btn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,10 +107,10 @@ func (btn Button) ToTelegramInline() apix.InlineKeyboardButton {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if btn.Url != "" {
|
if btn.URL != "" {
|
||||||
return apix.NewInlineKeyboardButtonURL(
|
return apix.NewInlineKeyboardButtonURL(
|
||||||
btn.Text,
|
btn.Text,
|
||||||
btn.Url,
|
btn.URL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ var StartWidget = tg.RenderFunc(func(c tg.Context) tg.UI {
|
||||||
).Inline(
|
).Inline(
|
||||||
tg.NewKeyboard().Row(
|
tg.NewKeyboard().Row(
|
||||||
tg.Buttonf("TeleGopher surdeus.su page").
|
tg.Buttonf("TeleGopher surdeus.su page").
|
||||||
WithUrl("https://surdeus.su/core/tg"),
|
WithURL("https://surdeus.su/core/tg"),
|
||||||
).Inline(),
|
).Inline(),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue