39 lines
983 B
Go
39 lines
983 B
Go
package main
|
||
|
||
import (
|
||
"git.nix13.pw/scuroneko/laniakea"
|
||
|
||
"kurumibot/database"
|
||
"kurumibot/plugins"
|
||
|
||
"github.com/joho/godotenv"
|
||
)
|
||
|
||
func main() {
|
||
_ = godotenv.Load(".env", ".env.production", ".env.ai")
|
||
|
||
database.ConnectPostgres()
|
||
database.ConnectMongo()
|
||
database.ConnectRedis()
|
||
|
||
bot := laniakea.NewBot(laniakea.LoadSettingsFromEnv())
|
||
dbCtx := &laniakea.DatabaseContext{
|
||
PostgresSQL: database.PostgresDatabase,
|
||
MongoDB: database.MongoClient,
|
||
Redis: database.RedisClient,
|
||
}
|
||
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
|
||
bot = bot.InitDatabaseContext(dbCtx)
|
||
bot.AddDatabaseLogger(plugins.DatabaseLogger)
|
||
bot.AddMiddleware(plugins.InitLogMiddleware())
|
||
|
||
plugins.RegisterService(bot)
|
||
plugins.RegisterAdmin(bot)
|
||
plugins.RegisterEconomy(bot)
|
||
plugins.RegisterWaifus(bot)
|
||
plugins.RegisterRP(bot)
|
||
|
||
defer bot.Close()
|
||
bot.Run()
|
||
}
|