feat: add persistent reply keyboard with Clock In / Clock Out buttons

Also handle button text (English + Persian) in message router.
This commit is contained in:
2026-06-23 21:44:41 +03:30
parent 5009bb130c
commit a92c72f46a

View File

@@ -27,9 +27,9 @@ func (h *Handler) HandleMessage(update tgbotapi.Update) {
switch msg.Text { switch msg.Text {
case "/start": case "/start":
h.handleStart(msg) h.handleStart(msg)
case "/clockin": case "/clockin", "Clock In", "ورود":
h.handleClockInMsg(msg) h.handleClockInMsg(msg)
case "/clockout": case "/clockout", "Clock Out", "خروج":
h.handleClockOutMsg(msg) h.handleClockOutMsg(msg)
case "/remote": case "/remote":
h.toggleRemote(msg) h.toggleRemote(msg)
@@ -73,6 +73,20 @@ func (h *Handler) handleStart(msg *tgbotapi.Message) {
reply := tgbotapi.NewMessage(msg.Chat.ID, text) reply := tgbotapi.NewMessage(msg.Chat.ID, text)
reply.ReplyMarkup = mainKeyboard() reply.ReplyMarkup = mainKeyboard()
_, _ = h.Bot.Send(reply) _, _ = h.Bot.Send(reply)
kb := quickKeyboard()
quick := tgbotapi.NewMessage(msg.Chat.ID, "Quick buttons added below:")
quick.ReplyMarkup = kb
_, _ = h.Bot.Send(quick)
}
func quickKeyboard() tgbotapi.ReplyKeyboardMarkup {
return tgbotapi.NewReplyKeyboard(
tgbotapi.NewKeyboardButtonRow(
tgbotapi.NewKeyboardButton("Clock In"),
tgbotapi.NewKeyboardButton("Clock Out"),
),
)
} }
func mainKeyboard() tgbotapi.InlineKeyboardMarkup { func mainKeyboard() tgbotapi.InlineKeyboardMarkup {