refactoring, fixes and laniakea v0.8

This commit is contained in:
2026-02-19 14:02:25 +03:00
parent 0804398b6c
commit c9a5a81643
30 changed files with 219 additions and 190 deletions

32
main.go
View File

@@ -3,8 +3,8 @@ package main
import (
"git.nix13.pw/scuroneko/laniakea"
"kurumibot/database"
"kurumibot/plugins"
"ymgb/database"
"ymgb/plugins"
"github.com/joho/godotenv"
)
@@ -16,27 +16,29 @@ func main() {
database.ConnectMongo()
database.ConnectRedis()
bot := laniakea.NewBot(laniakea.LoadOptsFromEnv())
bot := laniakea.NewBot[database.Context](laniakea.LoadOptsFromEnv())
defer bot.Close()
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
bot = bot.DatabaseContext(&laniakea.DatabaseContext{
PostgresSQL: database.PostgresDatabase,
MongoDB: database.MongoClient,
Redis: database.RedisClient,
bot = bot.DatabaseContext(&database.Context{
Postgres: database.PostgresDatabase,
Mongo: database.MongoClient,
Redis: database.RedisClient,
})
bot.AddDatabaseLogger(plugins.DatabaseLogger)
bot.AddMiddleware(plugins.InitLogMiddleware())
plugins.RegisterService(bot)
plugins.RegisterAdmin(bot)
plugins.RegisterLogs(bot)
bot.AddPlugins(
plugins.RegisterService(),
plugins.RegisterAdmin(),
plugins.RegisterLogs(),
plugins.RegisterEconomy(bot),
plugins.RegisterWaifus(),
plugins.RegisterRP(),
plugins.RegisterAi(),
plugins.RegisterFun(),
)
plugins.RegisterEconomy(bot)
//plugins.RegisterRelations(bot)
plugins.RegisterWaifus(bot)
plugins.RegisterRP(bot)
plugins.RegisterAi(bot)
plugins.RegisterFun(bot)
if err := bot.AutoGenerateCommands(); err != nil {
panic(err)