diff --git a/src/Pootis-Bot/Modules/Audio/Music.cs b/src/Pootis-Bot/Modules/Audio/Music.cs
index e889a5b3..ec6b7349 100644
--- a/src/Pootis-Bot/Modules/Audio/Music.cs
+++ b/src/Pootis-Bot/Modules/Audio/Music.cs
@@ -36,7 +36,7 @@ await Context.Channel.SendMessageAsync(
return;
}
- await _service.JoinAudio(Context.Guild, ((IVoiceState) Context.User).VoiceChannel, Context.Channel);
+ await _service.JoinAudio(Context.Guild, ((IVoiceState) Context.User).VoiceChannel, Context.Channel, Context.User.Id);
}
[Command("leave", RunMode = RunMode.Async)]
diff --git a/src/Pootis-Bot/Services/Audio/AudioService.cs b/src/Pootis-Bot/Services/Audio/AudioService.cs
index 95524c96..25a86992 100644
--- a/src/Pootis-Bot/Services/Audio/AudioService.cs
+++ b/src/Pootis-Bot/Services/Audio/AudioService.cs
@@ -23,11 +23,12 @@ public class AudioService
///
/// Joins a guild voice channel, and sends messages to a text channel on error
///
- /// What guild are we in
- /// The voice channel we are attempting to join
- /// The message channel to log errors in
+ ///
+ ///
+ ///
+ ///
///
- public async Task JoinAudio(IGuild guild, IVoiceChannel target, IMessageChannel channel)
+ public async Task JoinAudio(IGuild guild, IVoiceChannel target, IMessageChannel channel, ulong userId)
{
if (target == null)
{
@@ -38,6 +39,12 @@ public async Task JoinAudio(IGuild guild, IVoiceChannel target, IMessageChannel
ServerMusicItem serverMusic = GetMusicList(guild.Id);
if (serverMusic != null)
{
+ if (serverMusic.AudioChannel.GetUser(userId) != null)
+ {
+ await channel.SendMessageAsync(":musical_note: I am already in the same audio channel as you!");
+ return;
+ }
+
await channel.SendMessageAsync(
":musical_note: Sorry, but I am already playing in a different audio channel at the moment.");
@@ -147,7 +154,7 @@ public async Task SendAudio(SocketGuild guild, IMessageChannel channel, IVoiceCh
if (serverList == null)
{
- await JoinAudio(guild, target, channel);
+ await JoinAudio(guild, target, channel, user.Id);
serverList = GetMusicList(guild.Id);
}