options: remove InlineKeyboardMarkup type

pull/452/head
Demian 2 years ago
parent 1004fb5df1
commit c46e31dff6

@ -86,7 +86,7 @@ type Result interface {
SetResultID(string)
SetParseMode(ParseMode)
SetContent(InputMessageContent)
SetReplyMarkup([][]InlineButton)
SetReplyMarkup(*ReplyMarkup)
Process(*Bot)
}

@ -17,7 +17,7 @@ type ResultBase struct {
Content InputMessageContent `json:"input_message_content,omitempty"`
// Optional. Inline keyboard attached to the message.
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// ResultID returns ResultBase.ID.
@ -41,8 +41,8 @@ func (r *ResultBase) SetContent(content InputMessageContent) {
}
// SetReplyMarkup sets ResultBase.ReplyMarkup.
func (r *ResultBase) SetReplyMarkup(keyboard [][]InlineButton) {
r.ReplyMarkup = &InlineKeyboardMarkup{InlineKeyboard: keyboard}
func (r *ResultBase) SetReplyMarkup(markup *ReplyMarkup) {
r.ReplyMarkup = markup
}
func (r *ResultBase) Process(b *Bot) {

@ -500,7 +500,7 @@ func (lt *Layout) ResultLocale(locale, k string, args ...interface{}) tele.Resul
if markup == nil {
log.Printf("telebot/layout: markup with name %s was not found\n", result.Markup)
} else {
r.SetReplyMarkup(markup.InlineKeyboard)
r.SetReplyMarkup(markup)
}
}

@ -240,7 +240,7 @@ type Message struct {
AutoDeleteTimer *AutoDeleteTimer `json:"message_auto_delete_timer_changed,omitempty"`
// Inline keyboard attached to the message.
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// MessageEntity object represents "special" parts of text messages,

@ -168,14 +168,6 @@ type ReplyButton struct {
Poll PollType `json:"request_poll,omitempty"`
}
// InlineKeyboardMarkup represents an inline keyboard that appears
// right next to the message it belongs to.
type InlineKeyboardMarkup struct {
// Array of button rows, each represented by
// an Array of KeyboardButton objects.
InlineKeyboard [][]InlineButton `json:"inline_keyboard,omitempty"`
}
// MarshalJSON implements json.Marshaler. It allows to pass
// PollType as keyboard's poll type instead of KeyboardButtonPollType object.
func (pt PollType) MarshalJSON() ([]byte, error) {

Loading…
Cancel
Save