From c3dc81bd29318a4916bf8fc383a0d1a5ca90fa64 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 16 Apr 2024 15:15:30 +0200 Subject: fix(reducer): sql error integer > int64max --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index ed84b8a..1a9693a 100644 --- a/main.go +++ b/main.go @@ -120,7 +120,18 @@ func main() { } func afterInit(dg *discordgo.Session) { + // handlers dg.AddHandler(xp.OnMessage) dg.AddHandler(xp.OnVoiceUpdate) dg.AddHandler(xp.OnLeave) + + // setup timer for periodic reducer + //d := 24 * time.Hour + //if gokord.Debug { + // // reduce for debug + // d = time.Minute + //} + //utils.NewTimer(d, func(stop chan struct{}) { + // xp.PeriodicReducer(dg) + //}) } -- cgit v1.2.3 From 7fe68106bec7133981ac91026156977e0c7b4ca1 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 16 Apr 2024 15:24:25 +0200 Subject: feat(reducer): periodic reducer updating xp --- main.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 1a9693a..d8cdbc2 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,12 @@ package main import ( "flag" "github.com/anhgelus/gokord" + "github.com/anhgelus/gokord/utils" "github.com/anhgelus/les-copaings-bot/commands" "github.com/anhgelus/les-copaings-bot/config" "github.com/anhgelus/les-copaings-bot/xp" "github.com/bwmarrin/discordgo" + "time" ) var token string @@ -126,12 +128,12 @@ func afterInit(dg *discordgo.Session) { dg.AddHandler(xp.OnLeave) // setup timer for periodic reducer - //d := 24 * time.Hour - //if gokord.Debug { - // // reduce for debug - // d = time.Minute - //} - //utils.NewTimer(d, func(stop chan struct{}) { - // xp.PeriodicReducer(dg) - //}) + d := 24 * time.Hour + if gokord.Debug { + // reduce time for debug + d = time.Minute + } + utils.NewTimer(d, func(stop chan struct{}) { + xp.PeriodicReducer(dg) + }) } -- cgit v1.2.3