fix: prefix calendar type callbacks with caltype_ to avoid conflict with cal_day/cal_prev/cal_next
Routes caltype_gregorian/jalali/hijri to selectCalendar and cal_day/cal_prev/cal_next to handleHistoryCallback as intended.
This commit is contained in:
@@ -171,8 +171,8 @@ func (h *Handler) HandleCallback(update tgbotapi.Update) {
|
||||
h.selectAccent(chatID, msgID, cb.ID, cb.Data[7:])
|
||||
return
|
||||
}
|
||||
if len(cb.Data) > 4 && cb.Data[:4] == "cal_" {
|
||||
h.selectCalendar(chatID, msgID, cb.ID, cb.Data[4:])
|
||||
if len(cb.Data) > 8 && cb.Data[:8] == "caltype_" {
|
||||
h.selectCalendar(chatID, msgID, cb.ID, cb.Data[8:])
|
||||
return
|
||||
}
|
||||
h.handleHistoryCallback(chatID, msgID, cb.ID, cb.Data)
|
||||
@@ -601,7 +601,7 @@ func (h *Handler) buildCalendarKeyboard(user *db.User) (string, tgbotapi.InlineK
|
||||
label = "> " + label
|
||||
}
|
||||
rows = append(rows, tgbotapi.NewInlineKeyboardRow(
|
||||
tgbotapi.NewInlineKeyboardButtonData(label, "cal_"+c),
|
||||
tgbotapi.NewInlineKeyboardButtonData(label, "caltype_"+c),
|
||||
))
|
||||
}
|
||||
rows = append(rows, tgbotapi.NewInlineKeyboardRow(
|
||||
|
||||
Reference in New Issue
Block a user