feat(command): prevent sending full time if days is set to 30
This commit is contained in:
parent
8d6af4b6aa
commit
9c64718c76
1 changed files with 13 additions and 4 deletions
|
@ -3,6 +3,7 @@ package commands
|
|||
import (
|
||||
"fmt"
|
||||
"github.com/anhgelus/gokord/utils"
|
||||
"github.com/anhgelus/les-copaings-bot/config"
|
||||
"github.com/anhgelus/les-copaings-bot/exp"
|
||||
"github.com/anhgelus/les-copaings-bot/user"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
|
@ -38,14 +39,22 @@ func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
Color: utils.Success,
|
||||
}
|
||||
}
|
||||
|
||||
wg.Add(3)
|
||||
cfg := config.GetGuildConfig(i.GuildID)
|
||||
if cfg.DaysXPRemains > 30 {
|
||||
wg.Add(1)
|
||||
go fn("Top full time", 10, -1, 0)
|
||||
}
|
||||
wg.Add(2)
|
||||
go fn("Top 30 jours", 5, 30, 1)
|
||||
go fn("Top 7 jours", 5, 7, 2)
|
||||
go func() {
|
||||
wg.Wait()
|
||||
err = resp.Embeds(embeds).Send()
|
||||
if cfg.DaysXPRemains > 30 {
|
||||
resp.Embeds(embeds)
|
||||
} else {
|
||||
resp.Embeds(embeds[1:])
|
||||
}
|
||||
err = resp.Send()
|
||||
if err != nil {
|
||||
utils.SendAlert("commands/top.go - Sending response top", err.Error())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue