48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package main
|
||
|
||
import (
|
||
"log"
|
||
|
||
"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 func() {
|
||
_ = bot.Close()
|
||
}()
|
||
bot = bot.ErrorTemplate(
|
||
"Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s",
|
||
).DatabaseContext(&database.Context{
|
||
Postgres: database.PostgresDatabase,
|
||
Mongo: database.MongoClient,
|
||
Redis: database.RedisClient,
|
||
}).AddDatabaseLoggerWriter(plugins.DatabaseLogger).AddMiddleware(plugins.InitLogMiddleware()).AddPlugins(
|
||
plugins.RegisterService(),
|
||
plugins.RegisterAdmin(),
|
||
plugins.RegisterLogs(),
|
||
plugins.RegisterEconomy(bot),
|
||
plugins.RegisterWaifus(),
|
||
plugins.RegisterRP(),
|
||
plugins.RegisterAi(),
|
||
plugins.RegisterFun(),
|
||
plugins.RegisterProxy(),
|
||
)
|
||
|
||
if err := bot.AutoGenerateCommands(); err != nil {
|
||
log.Println(err)
|
||
}
|
||
bot.Run()
|
||
}
|