feat(xp): send new level message in fallback channel for voice event
This commit is contained in:
parent
2b285f4523
commit
357466a92e
1 changed files with 10 additions and 2 deletions
12
xp/events.go
12
xp/events.go
|
@ -137,7 +137,15 @@ func onDisconnect(s *discordgo.Session, e *discordgo.VoiceStateUpdate, client *r
|
|||
}
|
||||
c := GetCopaing(u.DiscordID, u.GuildID)
|
||||
e.Member.GuildID = e.GuildID
|
||||
c.AddXP(s, e.Member, XPVocal(uint(timeInVocal)), func(_ uint, _ uint) {
|
||||
//TODO: handle new level in vocal
|
||||
c.AddXP(s, e.Member, XPVocal(uint(timeInVocal)), func(_ uint, newLevel uint) {
|
||||
cfg := config.GetGuildConfig(e.GuildID)
|
||||
_, err = s.ChannelMessageSend(cfg.FallbackChannel, fmt.Sprintf(
|
||||
"%s est maintenant niveau %d",
|
||||
e.Member.Mention(),
|
||||
newLevel,
|
||||
))
|
||||
if err != nil {
|
||||
utils.SendAlert("xp/events.go - Sending new level in fallback channel", err.Error())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue