1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

fix: fix loyalty system (after sync refactor)

This commit is contained in:
Ash Keel 2023-02-01 13:33:30 +01:00
parent 7ebf0f9670
commit 6953947521
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 6 additions and 3 deletions

View file

@ -73,7 +73,7 @@ func NewManager(db *database.LocalDBClient, twitchManager *twitch.Manager, logge
// Retrieve configs
var rewards []Reward
if err := db.GetJSON(RewardsKey, &rewards); err != nil {
if err := db.GetJSON(RewardsKey, &rewards); err == nil {
loyalty.Rewards.Set(rewards)
} else {
if !errors.Is(err, database.ErrEmptyKey) {
@ -82,7 +82,7 @@ func NewManager(db *database.LocalDBClient, twitchManager *twitch.Manager, logge
}
var goals []Goal
if err := db.GetJSON(GoalsKey, &goals); err != nil {
if err := db.GetJSON(GoalsKey, &goals); err == nil {
loyalty.Goals.Set(goals)
} else {
if !errors.Is(err, database.ErrEmptyKey) {
@ -91,7 +91,7 @@ func NewManager(db *database.LocalDBClient, twitchManager *twitch.Manager, logge
}
var queue []Redeem
if err := db.GetJSON(QueueKey, &queue); err != nil {
if err := db.GetJSON(QueueKey, &queue); err == nil {
loyalty.Queue.Set(queue)
} else {
if !errors.Is(err, database.ErrEmptyKey) {

View file

@ -16,6 +16,7 @@ import (
func (m *Manager) SetupTwitch() {
bot := m.twitchManager.Client().Bot
if bot == nil {
m.logger.Warn("bot is offline or not configured, could not setup commands")
return
}
@ -120,6 +121,8 @@ func (m *Manager) SetupTwitch() {
}
}
}()
m.logger.Info("loyalty twitch setup completed")
}
func (m *Manager) StopTwitch() {