handle paidcallback: callback

This commit is contained in:
Akulij 2025-05-05 19:32:23 +03:00
parent 8352829b92
commit d92e4899c8

View File

@ -159,6 +159,19 @@ func handleCallbackQuery(bc BotController, update tgbotapi.Update) {
json.Unmarshal([]byte(meta), &entities) json.Unmarshal([]byte(meta), &entities)
msg.Entities = entities msg.Entities = entities
bc.bot.Send(msg) bc.bot.Send(msg)
} else if strings.HasPrefix(update.CallbackQuery.Data, "paidcallback:") {
token := strings.Split(update.CallbackQuery.Data, ":")[1]
reservationid, err := strconv.ParseInt(token, 10, 64)
if err != nil {
log.Printf("Error parsing reservation token: %s\n", err)
return
}
reservation, _ := bc.GetReservationByID(reservationid)
reservation.Status = Paid
bc.UpdateReservation(reservation)
notifyPaid(bc, reservation)
sendMessage(bc, update.CallbackQuery.From.ID, bc.GetBotContent("post_payment_message"))
} else if user.IsEffectiveAdmin() { } else if user.IsEffectiveAdmin() {
handleAdminCallback(bc, update, user) handleAdminCallback(bc, update, user)
} }