This commit is contained in:
Akulij 2025-03-29 19:19:47 +08:00
parent 8b6317b31a
commit ed99f4a16f
5 changed files with 144 additions and 138 deletions

View File

@ -139,10 +139,12 @@ func (bc BotController) LogMessageRaw(UserID int64, Msg string, Time time.Time)
} }
type ReservationStatus int64 type ReservationStatus int64
const ( const (
Booked ReservationStatus = iota Booked ReservationStatus = iota
Paid Paid
) )
var ReservationStatusString = []string{ var ReservationStatusString = []string{
"Забронировано", "Забронировано",
"Оплачено", "Оплачено",
@ -200,6 +202,7 @@ func (bc BotController) GetEvent(EventID int64) (Event, error) {
} }
type TaskType int64 type TaskType int64
const ( const (
SyncSheet TaskType = iota SyncSheet TaskType = iota
NotifyAboutEvent NotifyAboutEvent

View File

@ -26,7 +26,9 @@ func (bc *BotController) SyncPaidUsersToSheet() error {
values = append(values, []interface{}{"Телеграм ID", "Имя", "Фамилия", "Никнейм", "Указанное имя", "Дата", "Телефон", "Статус"}) values = append(values, []interface{}{"Телеграм ID", "Имя", "Фамилия", "Никнейм", "Указанное имя", "Дата", "Телефон", "Статус"})
for _, reservation := range reservations { for _, reservation := range reservations {
if reservation.Status != Paid {continue} if reservation.Status != Paid {
continue
}
uid := reservation.UserID uid := reservation.UserID
user, _ := bc.GetUserByID(uid) user, _ := bc.GetUserByID(uid)

View File

@ -1,16 +1,16 @@
package main package main
import ( import (
"encoding/json"
"fmt" "fmt"
"time"
"io" "io"
"log" "log"
"math"
"net/http" "net/http"
"os" "os"
"strconv" "strconv"
"strings" "strings"
"encoding/json" "time"
"math"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
) )
@ -51,7 +51,6 @@ func main() {
log.Printf("Location: %s\n", dubaiLocation.String()) log.Printf("Location: %s\n", dubaiLocation.String())
log.Printf("Diff: %s\n", nearestDates[0].Sub(time.Now())) log.Printf("Diff: %s\n", nearestDates[0].Sub(time.Now()))
// TODO: REMOVE // TODO: REMOVE
for _, date := range nearestDates { for _, date := range nearestDates {
event := Event{Date: &date} event := Event{Date: &date}
@ -248,7 +247,9 @@ func handleDeopCommand(bc BotController, update tgbotapi.Update, user User) {
} }
func handleBroadcastCommand(bc BotController, update tgbotapi.Update, user User) { func handleBroadcastCommand(bc BotController, update tgbotapi.Update, user User) {
if !user.IsAdmin() {return} if !user.IsAdmin() {
return
}
var users []User var users []User
bc.db.Find(&users) bc.db.Find(&users)