Merge branch 'main' into refactor/config-command

This commit is contained in:
Anhgelus Morhtuuzh 2025-08-21 13:26:17 +02:00
commit bbfaaaf04b
Signed by: anhgelus
GPG key ID: CAD341EFA92DDDE5
5 changed files with 30 additions and 40 deletions

17
main.go
View file

@ -4,16 +4,17 @@ import (
_ "embed"
"errors"
"flag"
"os"
"time"
"github.com/anhgelus/gokord"
cmd "github.com/anhgelus/gokord/cmd"
"github.com/anhgelus/gokord/cmd"
"github.com/anhgelus/gokord/logger"
"github.com/anhgelus/les-copaings-bot/commands"
"github.com/anhgelus/les-copaings-bot/config"
"github.com/anhgelus/les-copaings-bot/user"
"github.com/bwmarrin/discordgo"
"github.com/joho/godotenv"
"os"
"time"
)
var (
@ -117,7 +118,15 @@ func main() {
creditsCmd,
},
AfterInit: func(dg *discordgo.Session) {
stopPeriodicReducer = gokord.NewTimer(24*time.Hour, func(stop chan<- interface{}) {
d := 24 * time.Hour
if gokord.Debug {
d = 24 * time.Second
}
user.PeriodicReducer(dg)
stopPeriodicReducer = gokord.NewTimer(d, func(stop chan<- interface{}) {
logger.Debug("Periodic reducer")
user.PeriodicReducer(dg)
})
},