diff options
| author | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-06-05 15:17:45 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-06-05 15:17:45 +0200 |
| commit | defc781f9a66b0fe25a79356ac5ac0c2143003f9 (patch) | |
| tree | 41e4fd56aecbaee5c53e744d9d7d8bdbdc76b94c | |
| parent | 48eb4410ad14d74b3f1925d263b8fe32c472a648 (diff) | |
fix(xp): adding xp if user joins a disabled voice channel in certain conditions
| -rw-r--r-- | events.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -51,12 +51,12 @@ func OnVoiceUpdate(s *discordgo.Session, e *discordgo.VoiceStateUpdate) { return } cfg := config.GetGuildConfig(e.GuildID) - if e.BeforeUpdate == nil && e.ChannelID != "" { + if (e.BeforeUpdate == nil || cfg.IsDisabled(e.BeforeUpdate.ChannelID)) && e.ChannelID != "" { if cfg.IsDisabled(e.ChannelID) { return } onConnection(s, e) - } else if e.BeforeUpdate != nil && e.ChannelID == "" { + } else if e.BeforeUpdate != nil && (e.ChannelID == "" || cfg.IsDisabled(e.ChannelID)) { if cfg.IsDisabled(e.BeforeUpdate.ChannelID) { return } @@ -73,8 +73,8 @@ func onDisconnect(s *discordgo.Session, e *discordgo.VoiceStateUpdate) { now := time.Now().Unix() c := user.GetCopaing(e.UserID, e.GuildID) // check the validity of user - con := connectedSince[e.UserID] - if con == NotConnected { + con, ok := connectedSince[e.UserID] + if !ok || con == NotConnected { utils.SendWarn(fmt.Sprintf( "User %s diconnect from a vocal but was registered as not connected", e.Member.DisplayName(), )) |
