some fixes

This commit is contained in:
2026-01-20 10:06:37 +03:00
parent fec89b5305
commit 02437946ed
4 changed files with 45 additions and 8 deletions

View File

@@ -2,8 +2,8 @@ package mdb
import (
"context"
"kurumibot/database"
"kurumibot/laniakea"
"os"
"time"
)
@@ -19,7 +19,7 @@ type ConsoleLogEntry struct {
func WriteConsoleLog(db *laniakea.DatabaseContext, e *ConsoleLogEntry) error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
col := db.MongoDB.Database(os.Getenv("MONGO_NAME")).Collection("logs")
col := database.GetMongoCollection(db, "logs")
_, err := col.InsertOne(ctx, e)
return err
}
@@ -35,7 +35,7 @@ type MessageLogEntry struct {
func WriteMessageLog(db *laniakea.DatabaseContext, e *MessageLogEntry) error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
collection := db.MongoDB.Database(os.Getenv("MONGO_NAME")).Collection("msg_logs")
_, err := collection.InsertOne(ctx, e)
col := database.GetMongoCollection(db, "msg_logs")
_, err := col.InsertOne(ctx, e)
return err
}