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:
@@ -27,9 +27,9 @@ func (h *Handler) HandleMessage(update tgbotapi.Update) {
|
||||
switch msg.Text {
|
||||
case "/start":
|
||||
h.handleStart(msg)
|
||||
case "/clockin":
|
||||
case "/clockin", "Clock In", "ورود":
|
||||
h.handleClockInMsg(msg)
|
||||
case "/clockout":
|
||||
case "/clockout", "Clock Out", "خروج":
|
||||
h.handleClockOutMsg(msg)
|
||||
case "/remote":
|
||||
h.toggleRemote(msg)
|
||||
@@ -73,6 +73,20 @@ func (h *Handler) handleStart(msg *tgbotapi.Message) {
|
||||
reply := tgbotapi.NewMessage(msg.Chat.ID, text)
|
||||
reply.ReplyMarkup = mainKeyboard()
|
||||
_, _ = 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 {
|
||||
|
||||
Reference in New Issue
Block a user