@@ -2,6 +2,7 @@ package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@@ -132,7 +133,7 @@ func (db *DB) SetStatusToChat(chatID int64, status UserState) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (db *DB) GetStat(chatID int64) (map[string]int, error) {
|
||||
func (db *DB) GetStat(chatID int64, cron bool) (map[string]int, error) {
|
||||
if err := db.AddChat(chatID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -145,7 +146,13 @@ func (db *DB) GetStat(chatID int64) (map[string]int, error) {
|
||||
}
|
||||
|
||||
loc, _ := time.LoadLocation("Asia/Novosibirsk")
|
||||
t := time.Now().In(loc).Add(-24 * time.Hour)
|
||||
t := time.Now().In(loc)
|
||||
if cron {
|
||||
t = t.Add(-24 * time.Hour)
|
||||
}
|
||||
if !cron {
|
||||
t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, loc)
|
||||
}
|
||||
|
||||
res := map[string]int{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user