From d0253f36b4b4b98f936efeb973f588affb35c935 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 10 Mar 2025 21:53:59 +0100 Subject: feat(copaing): restore data if copaing rejoins after max 48 hours --- main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b019b7c..5bbc289 100644 --- a/main.go +++ b/main.go @@ -18,9 +18,11 @@ var ( updatesData []byte Version = gokord.Version{ Major: 2, - Minor: 3, - Patch: 5, - } // git version: 0.3.5 (it's the v2 of the bot) + Minor: 4, + Patch: 0, + } // git version: 0.4.0 (it's the v2 of the bot) + + stopPeriodicReducer chan<- interface{} ) func init() { @@ -170,6 +172,10 @@ func main() { } bot.Start() + if stopPeriodicReducer != nil { + stopPeriodicReducer <- true + } + xp.CloseRedisClient() } @@ -185,7 +191,7 @@ func afterInit(dg *discordgo.Session) { // reduce time for debug d = time.Minute } - utils.NewTimer(d, func(stop chan<- interface{}) { + stopPeriodicReducer = utils.NewTimer(d, func(stop chan<- interface{}) { xp.PeriodicReducer(dg) }) } -- cgit v1.2.3