From 0804398b6c284e5eaa3ceb2eaac22e8bf8018f18 Mon Sep 17 00:00:00 2001 From: ScuroNeko Date: Thu, 19 Feb 2026 12:17:09 +0300 Subject: [PATCH] laniakea v0.7 --- .env.development | 4 +++- database/psql/users.go | 12 ++++++------ db.docker-compose.yml | 4 ++-- docker-compose.yml | 3 +-- go.mod | 4 ++-- go.sum | 4 ++-- main.go | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.env.development b/.env.development index 3ef951b..78fc035 100644 --- a/.env.development +++ b/.env.development @@ -3,4 +3,6 @@ TG_TOKEN= PREFIXES=/;! DEBUG=true USE_REQ_LOG=true -WRITE_TO_FILE=false \ No newline at end of file +WRITE_TO_FILE=false +USE_TEST_SERVER=true +API_URL=http://127.0.0.1:8081 \ No newline at end of file diff --git a/database/psql/users.go b/database/psql/users.go index f8d61aa..9c57c49 100644 --- a/database/psql/users.go +++ b/database/psql/users.go @@ -69,18 +69,18 @@ func (rep UserRepository) GetOrCreate(tgId int, name string) (*User, error) { } func (rep UserRepository) Create(id int, name string) (*User, error) { - user := User{} + user := new(User) err := rep.db.Get(user, "INSERT INTO users (id, name) VALUES ($1, $2) RETURNING *;", id, name) - return &user, err + return user, err } func (rep UserRepository) GetById(telegramId int) (*User, error) { - user := User{} - err := rep.db.Get(&user, "SELECT * FROM users WHERE id=$1;", telegramId) + user := new(User) + err := rep.db.Get(user, "SELECT * FROM users WHERE id=$1;", telegramId) if err != nil { - return &user, err + return user, err } - return rep.GetJoins(&user) + return rep.GetJoins(user) } func (rep UserRepository) GetJoins(user *User) (*User, error) { diff --git a/db.docker-compose.yml b/db.docker-compose.yml index 064c43f..88666af 100644 --- a/db.docker-compose.yml +++ b/db.docker-compose.yml @@ -1,6 +1,6 @@ services: postgres: - image: postgres:18.1-alpine + image: postgres:18.2-alpine3.23 networks: - bot ports: @@ -19,7 +19,7 @@ services: - ./scripts/postgres:/docker-entrypoint-initdb.d - postgres_data:/var/lib/postgresql/data mongo: - image: mongo:noble + image: mongo:8.2.5-noble networks: - bot ports: diff --git a/docker-compose.yml b/docker-compose.yml index 7009dcd..539f538 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -name: "kurumibot" +name: "ymbot" include: - db.docker-compose.yml services: @@ -20,7 +20,6 @@ services: postgres: condition: service_healthy restart: true - networks: bot: driver: bridge \ No newline at end of file diff --git a/go.mod b/go.mod index 435b44b..8221d24 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.26.0 require ( git.nix13.pw/scuroneko/extypes v1.2.0 - git.nix13.pw/scuroneko/laniakea v0.6.2 + git.nix13.pw/scuroneko/laniakea v0.7.1 git.nix13.pw/scuroneko/slog v1.0.2 github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 @@ -15,7 +15,7 @@ require ( go.mongodb.org/mongo-driver/v2 v2.5.0 ) -//replace git.nix13.pw/scuroneko/laniakea v0.6.2 => ./laniakea +//replace git.nix13.pw/scuroneko/laniakea v0.7.0 => ./laniakea //replace git.nix13.pw/scuroneko/extypes v1.2.0 => ../go-extypes //replace git.nix13.pw/scuroneko/slog v1.0.2 => ../slog diff --git a/go.sum b/go.sum index b3fbd92..758b265 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= git.nix13.pw/scuroneko/extypes v1.2.0 h1:2n2hD6KsMAted+6MGhAyeWyli2Qzc9G2y+pQNB7C1dM= git.nix13.pw/scuroneko/extypes v1.2.0/go.mod h1:uZVs8Yo3RrYAG9dMad6qR6lsYY67t+459D9c65QAYAw= -git.nix13.pw/scuroneko/laniakea v0.6.2 h1:YsXvTPB10lmunWiLGlYorrZ5qbYJp00xy8HSA/4EdyI= -git.nix13.pw/scuroneko/laniakea v0.6.2/go.mod h1:ABjrmhKkTbhTwlMs+bLCr2e+ANnHbYTeidaicl2F0Z4= +git.nix13.pw/scuroneko/laniakea v0.7.1 h1:OIIsZ4qdgHevicOHsYTD+yviGIxvd30Wi6j56QptC3Q= +git.nix13.pw/scuroneko/laniakea v0.7.1/go.mod h1:ABjrmhKkTbhTwlMs+bLCr2e+ANnHbYTeidaicl2F0Z4= git.nix13.pw/scuroneko/slog v1.0.2 h1:vZyUROygxC2d5FJHUQM/30xFEHY1JT/aweDZXA4rm2g= git.nix13.pw/scuroneko/slog v1.0.2/go.mod h1:3Qm2wzkR5KjwOponMfG7TcGSDjmYaFqRAmLvSPTuWJI= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= diff --git a/main.go b/main.go index ead8abf..fcb9a87 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ func main() { database.ConnectMongo() database.ConnectRedis() - bot := laniakea.NewBot(laniakea.LoadSettingsFromEnv()) + bot := laniakea.NewBot(laniakea.LoadOptsFromEnv()) defer bot.Close() bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s") bot = bot.DatabaseContext(&laniakea.DatabaseContext{