42 lines
988 B
Go
42 lines
988 B
Go
package screens
|
|
|
|
import (
|
|
"github.com/NicoNex/echotron/v3"
|
|
)
|
|
|
|
var emptyKeyboard = Keyboard()
|
|
var refreshKeyboard = Keyboard(Row(Button("↻ Обновить", "refresh")))
|
|
|
|
func Button(text, data string) echotron.InlineKeyboardButton {
|
|
return echotron.InlineKeyboardButton{
|
|
Text: text,
|
|
CallbackData: data,
|
|
}
|
|
}
|
|
|
|
func Stylish(btn echotron.InlineKeyboardButton, style echotron.ButtonStyle) echotron.InlineKeyboardButton {
|
|
btn.Style = style
|
|
|
|
return btn
|
|
}
|
|
|
|
func URLButton(text, url string) echotron.InlineKeyboardButton {
|
|
return echotron.InlineKeyboardButton{
|
|
Text: text,
|
|
URL: url,
|
|
}
|
|
}
|
|
|
|
func Row(buttons ...echotron.InlineKeyboardButton) []echotron.InlineKeyboardButton { return buttons }
|
|
|
|
func Keyboard(rows ...[]echotron.InlineKeyboardButton) echotron.InlineKeyboardMarkup {
|
|
if len(rows) == 0 {
|
|
return echotron.InlineKeyboardMarkup{
|
|
InlineKeyboard: [][]echotron.InlineKeyboardButton{},
|
|
}
|
|
}
|
|
return echotron.InlineKeyboardMarkup{
|
|
InlineKeyboard: rows,
|
|
}
|
|
}
|