many changes
This commit is contained in:
25
main.go
25
main.go
@@ -12,7 +12,6 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println(laniakea.EscapeMarkdownV2("Загрузка..."))
|
||||
_ = godotenv.Load(".env", ".env.production", ".env.ai")
|
||||
|
||||
database.ConnectPostgres()
|
||||
@@ -20,22 +19,16 @@ func main() {
|
||||
database.ConnectRedis()
|
||||
|
||||
bot := laniakea.NewBot[database.Context](laniakea.LoadOptsFromEnv())
|
||||
defer func(bot *laniakea.Bot[database.Context]) {
|
||||
err := bot.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}(bot)
|
||||
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
|
||||
bot = bot.DatabaseContext(&database.Context{
|
||||
defer func() {
|
||||
_ = bot.Close()
|
||||
}()
|
||||
bot = bot.ErrorTemplate(
|
||||
"Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s",
|
||||
).DatabaseContext(&database.Context{
|
||||
Postgres: database.PostgresDatabase,
|
||||
Mongo: database.MongoClient,
|
||||
Redis: database.RedisClient,
|
||||
})
|
||||
bot.AddDatabaseLoggerWriter(plugins.DatabaseLogger)
|
||||
bot.AddMiddleware(plugins.InitLogMiddleware())
|
||||
|
||||
bot.AddPlugins(
|
||||
}).AddDatabaseLoggerWriter(plugins.DatabaseLogger).AddMiddleware(plugins.InitLogMiddleware()).AddPlugins(
|
||||
plugins.RegisterService(),
|
||||
plugins.RegisterAdmin(),
|
||||
plugins.RegisterLogs(),
|
||||
@@ -47,10 +40,8 @@ func main() {
|
||||
plugins.RegisterProxy(),
|
||||
)
|
||||
|
||||
//plugins.RegisterRelations(bot)
|
||||
|
||||
if err := bot.AutoGenerateCommands(); err != nil {
|
||||
panic(err)
|
||||
log.Println(err)
|
||||
}
|
||||
bot.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user