Skip to content

Commit

Permalink
fix: bot quitting when nickname is changed
Browse files Browse the repository at this point in the history
Only on my server, for some reason the "CommunicationDisabledUntil" parameter was not nil: checking if it comes after the current time fixes the problem
  • Loading branch information
TheTipo01 committed Feb 24, 2024
1 parent cbe2424 commit ff3e3b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ func voiceStateUpdate(s *discordgo.Session, v *discordgo.VoiceStateUpdate) {

func guildMemberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUpdate) {
// If we've been timed out, stop the music
if m.User.ID == s.State.User.ID && m.CommunicationDisabledUntil != nil && server[m.GuildID].IsPlaying() {
if m.User.ID == s.State.User.ID && m.CommunicationDisabledUntil != nil &&
m.CommunicationDisabledUntil.After(time.Now()) && server[m.GuildID].IsPlaying() {
ClearAndExit(server[m.GuildID])
}
}
Expand Down

0 comments on commit ff3e3b6

Please sign in to comment.