fix(xp): adding xp if user joins a disabled voice channel in certain conditions
This commit is contained in:
parent
48eb4410ad
commit
defc781f9a
1 changed files with 4 additions and 4 deletions
|
@ -51,12 +51,12 @@ func OnVoiceUpdate(s *discordgo.Session, e *discordgo.VoiceStateUpdate) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cfg := config.GetGuildConfig(e.GuildID)
|
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) {
|
if cfg.IsDisabled(e.ChannelID) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
onConnection(s, e)
|
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) {
|
if cfg.IsDisabled(e.BeforeUpdate.ChannelID) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ func onDisconnect(s *discordgo.Session, e *discordgo.VoiceStateUpdate) {
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
c := user.GetCopaing(e.UserID, e.GuildID)
|
c := user.GetCopaing(e.UserID, e.GuildID)
|
||||||
// check the validity of user
|
// check the validity of user
|
||||||
con := connectedSince[e.UserID]
|
con, ok := connectedSince[e.UserID]
|
||||||
if con == NotConnected {
|
if !ok || con == NotConnected {
|
||||||
utils.SendWarn(fmt.Sprintf(
|
utils.SendWarn(fmt.Sprintf(
|
||||||
"User %s diconnect from a vocal but was registered as not connected", e.Member.DisplayName(),
|
"User %s diconnect from a vocal but was registered as not connected", e.Member.DisplayName(),
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue