2023-07-09 01:28:59 +03:00
|
|
|
package behx
|
|
|
|
|
|
|
|
import (
|
|
|
|
apix "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
|
|
|
)
|
|
|
|
|
|
|
|
// The type wraps Telegram API's button to provide Action functionality.
|
|
|
|
type Button struct {
|
|
|
|
apix.KeyboardButton
|
2023-07-12 00:33:51 +03:00
|
|
|
Action Action
|
2023-07-09 01:28:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type ButtonMap map[string] *Button
|
|
|
|
|
|
|
|
// Represents the reply button row.
|
|
|
|
type ButtonRow []*Button
|
|
|
|
|
|
|
|
// Returns new button with specified text and action.
|
|
|
|
func NewButton(text string, action Action) *Button {
|
|
|
|
return &Button{
|
2023-07-12 00:33:51 +03:00
|
|
|
KeyboardButton: apix.NewKeyboardButton(text),
|
2023-07-09 01:28:59 +03:00
|
|
|
Action: action,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewButtonRow(btns ...*Button) ButtonRow {
|
|
|
|
return btns
|
|
|
|
}
|
|
|
|
|