some fixes
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user