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:
2026-06-24 09:50:28 +03:30
parent b900710196
commit b6c7cf81c8

View File

@@ -171,8 +171,8 @@ func (h *Handler) HandleCallback(update tgbotapi.Update) {
h.selectAccent(chatID, msgID, cb.ID, cb.Data[7:]) h.selectAccent(chatID, msgID, cb.ID, cb.Data[7:])
return return
} }
if len(cb.Data) > 4 && cb.Data[:4] == "cal_" { if len(cb.Data) > 8 && cb.Data[:8] == "caltype_" {
h.selectCalendar(chatID, msgID, cb.ID, cb.Data[4:]) h.selectCalendar(chatID, msgID, cb.ID, cb.Data[8:])
return return
} }
h.handleHistoryCallback(chatID, msgID, cb.ID, cb.Data) h.handleHistoryCallback(chatID, msgID, cb.ID, cb.Data)
@@ -601,7 +601,7 @@ func (h *Handler) buildCalendarKeyboard(user *db.User) (string, tgbotapi.InlineK
label = "> " + label label = "> " + label
} }
rows = append(rows, tgbotapi.NewInlineKeyboardRow( rows = append(rows, tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData(label, "cal_"+c), tgbotapi.NewInlineKeyboardButtonData(label, "caltype_"+c),
)) ))
} }
rows = append(rows, tgbotapi.NewInlineKeyboardRow( rows = append(rows, tgbotapi.NewInlineKeyboardRow(