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:
parent
7ebf0f9670
commit
6953947521
2 changed files with 6 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue