go fmt
This commit is contained in:
parent
8b6317b31a
commit
ed99f4a16f
@ -139,10 +139,12 @@ func (bc BotController) LogMessageRaw(UserID int64, Msg string, Time time.Time)
|
||||
}
|
||||
|
||||
type ReservationStatus int64
|
||||
|
||||
const (
|
||||
Booked ReservationStatus = iota
|
||||
Paid
|
||||
)
|
||||
|
||||
var ReservationStatusString = []string{
|
||||
"Забронировано",
|
||||
"Оплачено",
|
||||
@ -200,6 +202,7 @@ func (bc BotController) GetEvent(EventID int64) (Event, error) {
|
||||
}
|
||||
|
||||
type TaskType int64
|
||||
|
||||
const (
|
||||
SyncSheet TaskType = iota
|
||||
NotifyAboutEvent
|
||||
|
||||
@ -26,7 +26,9 @@ func (bc *BotController) SyncPaidUsersToSheet() error {
|
||||
values = append(values, []interface{}{"Телеграм ID", "Имя", "Фамилия", "Никнейм", "Указанное имя", "Дата", "Телефон", "Статус"})
|
||||
|
||||
for _, reservation := range reservations {
|
||||
if reservation.Status != Paid {continue}
|
||||
if reservation.Status != Paid {
|
||||
continue
|
||||
}
|
||||
|
||||
uid := reservation.UserID
|
||||
user, _ := bc.GetUserByID(uid)
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"encoding/json"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
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("Diff: %s\n", nearestDates[0].Sub(time.Now()))
|
||||
|
||||
|
||||
// TODO: REMOVE
|
||||
for _, date := range nearestDates {
|
||||
event := Event{Date: &date}
|
||||
@ -84,7 +83,7 @@ func notifyAboutEvents(bc BotController) {
|
||||
events, _ := bc.GetAllEvents()
|
||||
for _, event := range events {
|
||||
delta := event.Date.Sub(time.Now())
|
||||
if int(math.Floor(delta.Minutes())) == 8 * 60 { // 8 hours
|
||||
if int(math.Floor(delta.Minutes())) == 8*60 { // 8 hours
|
||||
reservations, _ := bc.GetReservationsByEventID(event.ID)
|
||||
for _, reservation := range reservations {
|
||||
uid := reservation.UserID
|
||||
@ -248,7 +247,9 @@ func handleDeopCommand(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
|
||||
bc.db.Find(&users)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user