feat(event): remove copaing on leave

This commit is contained in:
Anhgelus Morhtuuzh 2024-04-15 18:17:12 +02:00
parent 3eab56e368
commit 7d4e050c3f
No known key found for this signature in database
GPG key ID: CF4550297832A29F
2 changed files with 7 additions and 0 deletions

View file

@ -117,4 +117,5 @@ func main() {
func afterInit(dg *discordgo.Session) {
dg.AddHandler(xp.OnMessage)
dg.AddHandler(xp.OnVoiceUpdate)
dg.AddHandler(xp.OnLeave)
}

View file

@ -153,3 +153,9 @@ func onDisconnect(s *discordgo.Session, e *discordgo.VoiceStateUpdate, client *r
}
})
}
func OnLeave(_ *discordgo.Session, e *discordgo.GuildMemberRemove) {
utils.SendDebug("Leave event", "user_id", e.User.ID)
c := GetCopaing(e.User.ID, e.GuildID)
gokord.DB.Delete(c)
}