private async Task OnMessageReceived(SocketMessage arg) { var author = arg.Author as IGuildUser; var voiceChannel = author?.VoiceChannel as SocketVoiceChannel; if (voiceChannel?.Id != Program.DiscordChannelId) { return; } if (arg.Content == "!dd start" && voiceChannel != null) { Console.WriteLine("Joining voice channel: " + voiceChannel.Name); _voiceChannelWorker?.TryEnsureStarted(); } else if (arg.Content == "!dd skip" && voiceChannel != null) { _voiceChannelWorker?.TrySkip(); } else if (arg.Content == "!dd stop") { if (_voiceChannelWorker != null) { await _voiceChannelWorker.StopAsync(); } } else if (arg.Content == "!dd info") { var currentSong = _voiceChannelWorker?.CurrentSong; _ = arg.Channel.SendMessageAsync("Now playing " + currentSong?.Title + " - " + currentSong?.Url); } else if (arg.Content.StartsWith("!dd play ")) { var url = arg.Content.Substring("!dd play ".Length); _ = Task.Run(async() => { var post = await _metadataManager.AddUserRequestAsync(url, arg.Author.Username); _voiceChannelWorker?.EnqueueSong(post.Id); await arg.Channel.SendMessageAsync("The song has been added to the queue"); }); } else if (arg.Content.StartsWith("!dd say ")) { var text = arg.Content.Substring("!dd say ".Length); _voiceChannelWorker?.Say(text); } else if (arg.Content.StartsWith("!dd pause")) { _voiceChannelWorker?.TryPauseMainTrack(); } else if (arg.Content.StartsWith("!dd resume")) { _voiceChannelWorker?.TryResumeMainTrack(); } }