Implement Persentance with SQLite3 (#6)

This commit is contained in:
2023-04-01 03:48:01 -04:00
committed by GitHub
parent e1038a15cd
commit a40ec4dd78
9 changed files with 904 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/yeslayla/birdbot/app"
"github.com/yeslayla/birdbot/core"
"github.com/yeslayla/birdbot/modules"
"github.com/yeslayla/birdbot/persistence"
)
const PluginsDirectory = "./plugins"
@@ -50,6 +51,11 @@ func main() {
}
}
db := persistence.NewSqlite3Database()
if err := db.MigrateUp(); err != nil {
log.Fatal("Failed to migrate db: ", err)
}
bot := app.NewBot()
if err := bot.Initialize(cfg); err != nil {
@@ -70,7 +76,7 @@ func main() {
if cfg.Features.RoleSelection.IsEnabledByDefault() {
for _, v := range cfg.Discord.RoleSelections {
loader.LoadComponent(modules.NewRoleSelectionComponent(bot.Session, v))
loader.LoadComponent(modules.NewRoleSelectionComponent(bot.Session, db, v))
}
}