From b0137e83fc20c355036f064702c0816c62978af2 Mon Sep 17 00:00:00 2001 From: Akulij Date: Mon, 5 May 2025 19:33:43 +0300 Subject: [PATCH] handle user state enternamereservation --- cmd/app/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/app/main.go b/cmd/app/main.go index 8b31623..fb61ea1 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -335,6 +335,19 @@ func handleDefaultMessage(bc BotController, update tgbotapi.Update, user User) { bc.db.Model(&user).Update("state", "start") msg := tgbotapi.NewMessage(update.Message.Chat.ID, bc.GetBotContent("sended_notify")) bc.bot.Send(msg) + } else if strings.HasPrefix(user.State, "enternamereservation:") { + resstr := strings.Split(user.State, ":")[1] + reservationid, _ := strconv.ParseInt(resstr, 10, 64) + reservation, _ := bc.GetReservationByID(reservationid) + reservation.EnteredName = update.Message.Text + nd := time.Now().In(dubaiLocation) + reservation.TimeBooked = &nd + bc.UpdateReservation(reservation) + + sendMessageKeyboard(bc, user.ID, bc.GetBotContent("ask_to_pay"), + generateTgInlineKeyboard(map[string]string{"ТЕСТ оплачено": "paidcallback:" + strconv.FormatInt(reservationid, 10)}), + ) + } else if user.IsEffectiveAdmin() { if user.State != "start" { if strings.HasPrefix(user.State, "imgset:") {