mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-18 01:50:50 +00:00
fix: update the correct IRC bot instance so we don't keep more than one
fixes #40
This commit is contained in:
parent
7e7b796450
commit
d4bed8752f
1 changed files with 7 additions and 5 deletions
|
@ -98,17 +98,19 @@ func NewManager(db *database.LocalDBClient, server *http.Server, logger *zap.Log
|
||||||
if manager.client.Bot != nil {
|
if manager.client.Bot != nil {
|
||||||
err = manager.client.Bot.Close()
|
err = manager.client.Bot.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
client.logger.Warn("failed to disconnect old bot from Twitch IRC", zap.Error(err))
|
manager.client.logger.Warn("failed to disconnect old bot from Twitch IRC", zap.Error(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bot := newBot(manager.client, newBotConfig)
|
if manager.client.Config.Get().EnableBot {
|
||||||
if client.Config.Get().EnableBot {
|
bot := newBot(manager.client, newBotConfig)
|
||||||
go bot.Connect()
|
go bot.Connect()
|
||||||
|
manager.client.Bot = bot
|
||||||
|
} else {
|
||||||
|
manager.client.Bot = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Bot = bot
|
manager.client.logger.Info("reloaded/restarted Twitch bot")
|
||||||
client.logger.Info("reloaded/restarted Twitch bot")
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
client.logger.Error("could not setup twitch bot config reload subscription", zap.Error(err))
|
client.logger.Error("could not setup twitch bot config reload subscription", zap.Error(err))
|
||||||
|
|
Loading…
Reference in a new issue