49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package main
|
||
|
||
import (
|
||
"git.nix13.pw/scuroneko/laniakea"
|
||
|
||
"ymgb/database"
|
||
"ymgb/plugins"
|
||
|
||
"github.com/joho/godotenv"
|
||
)
|
||
|
||
func main() {
|
||
_ = godotenv.Load(".env", ".env.production", ".env.ai")
|
||
|
||
database.ConnectPostgres()
|
||
database.ConnectMongo()
|
||
database.ConnectRedis()
|
||
|
||
bot := laniakea.NewBot[database.Context](laniakea.LoadOptsFromEnv())
|
||
defer bot.Close()
|
||
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
|
||
bot = bot.DatabaseContext(&database.Context{
|
||
Postgres: database.PostgresDatabase,
|
||
Mongo: database.MongoClient,
|
||
Redis: database.RedisClient,
|
||
})
|
||
bot.AddDatabaseLoggerWriter(plugins.DatabaseLogger)
|
||
bot.AddMiddleware(plugins.InitLogMiddleware())
|
||
|
||
bot.AddPlugins(
|
||
plugins.RegisterService(),
|
||
plugins.RegisterAdmin(),
|
||
plugins.RegisterLogs(),
|
||
plugins.RegisterEconomy(bot),
|
||
plugins.RegisterWaifus(),
|
||
plugins.RegisterRP(),
|
||
plugins.RegisterAi(),
|
||
plugins.RegisterFun(),
|
||
plugins.RegisterProxy(),
|
||
)
|
||
|
||
//plugins.RegisterRelations(bot)
|
||
|
||
if err := bot.AutoGenerateCommands(); err != nil {
|
||
panic(err)
|
||
}
|
||
bot.Run()
|
||
}
|