mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-20 02:00:49 +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
|
// Retrieve configs
|
||||||
var rewards []Reward
|
var rewards []Reward
|
||||||
if err := db.GetJSON(RewardsKey, &rewards); err != nil {
|
if err := db.GetJSON(RewardsKey, &rewards); err == nil {
|
||||||
loyalty.Rewards.Set(rewards)
|
loyalty.Rewards.Set(rewards)
|
||||||
} else {
|
} else {
|
||||||
if !errors.Is(err, database.ErrEmptyKey) {
|
if !errors.Is(err, database.ErrEmptyKey) {
|
||||||
|
@ -82,7 +82,7 @@ func NewManager(db *database.LocalDBClient, twitchManager *twitch.Manager, logge
|
||||||
}
|
}
|
||||||
|
|
||||||
var goals []Goal
|
var goals []Goal
|
||||||
if err := db.GetJSON(GoalsKey, &goals); err != nil {
|
if err := db.GetJSON(GoalsKey, &goals); err == nil {
|
||||||
loyalty.Goals.Set(goals)
|
loyalty.Goals.Set(goals)
|
||||||
} else {
|
} else {
|
||||||
if !errors.Is(err, database.ErrEmptyKey) {
|
if !errors.Is(err, database.ErrEmptyKey) {
|
||||||
|
@ -91,7 +91,7 @@ func NewManager(db *database.LocalDBClient, twitchManager *twitch.Manager, logge
|
||||||
}
|
}
|
||||||
|
|
||||||
var queue []Redeem
|
var queue []Redeem
|
||||||
if err := db.GetJSON(QueueKey, &queue); err != nil {
|
if err := db.GetJSON(QueueKey, &queue); err == nil {
|
||||||
loyalty.Queue.Set(queue)
|
loyalty.Queue.Set(queue)
|
||||||
} else {
|
} else {
|
||||||
if !errors.Is(err, database.ErrEmptyKey) {
|
if !errors.Is(err, database.ErrEmptyKey) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
func (m *Manager) SetupTwitch() {
|
func (m *Manager) SetupTwitch() {
|
||||||
bot := m.twitchManager.Client().Bot
|
bot := m.twitchManager.Client().Bot
|
||||||
if bot == nil {
|
if bot == nil {
|
||||||
|
m.logger.Warn("bot is offline or not configured, could not setup commands")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +121,8 @@ func (m *Manager) SetupTwitch() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
m.logger.Info("loyalty twitch setup completed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) StopTwitch() {
|
func (m *Manager) StopTwitch() {
|
||||||
|
|
Loading…
Reference in a new issue