From b6c7cf81c841049b684fd06ab8cd1b86a7001436 Mon Sep 17 00:00:00 2001 From: db123 Date: Wed, 24 Jun 2026 09:50:28 +0330 Subject: [PATCH] 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. --- internal/bot/handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/bot/handlers.go b/internal/bot/handlers.go index 741e3a6..7d03d04 100644 --- a/internal/bot/handlers.go +++ b/internal/bot/handlers.go @@ -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(