Skip to content

Commit

Permalink
options: remove InlineKeyboardMarkup type
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Jan 21, 2022
1 parent 1004fb5 commit c46e31d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type Result interface {
SetResultID(string)
SetParseMode(ParseMode)
SetContent(InputMessageContent)
SetReplyMarkup([][]InlineButton)
SetReplyMarkup(*ReplyMarkup)
Process(*Bot)
}

Expand Down
6 changes: 3 additions & 3 deletions inline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion layout/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c46e31d

Please sign in to comment.