refactoring, fixes and laniakea v0.8
This commit is contained in:
32
main.go
32
main.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user