diff --git a/main.go b/main.go index 8a631df..1623f22 100644 --- a/main.go +++ b/main.go @@ -291,10 +291,14 @@ func enqueuePlay(user *discordgo.User, guild *discordgo.Guild, coll *SoundCollec if exists { if len(queues[guild.ID]) < maxQueueSize { + mutex.Lock() queues[guild.ID] <- play + mutex.Unlock() } } else { + mutex.Lock() queues[guild.ID] = make(chan *Play, maxQueueSize) + mutex.Unlock() playSound(play, nil) } }