public async Task Random(SocketCommandContext context, string[] _, ServerConfig serverConfig) { // If the bot is already in a voice channel in the server, then don't play a quote if (!((context.Guild.CurrentUser as IGuildUser)?.VoiceChannel is null)) { await context.Reply("I am already doing a quote calm down."); return; } var category = await GetRandomCategory(context.Guild.Id); var audio = await GetRandomAudioForCategory(context.Guild.Id, category.Id); var channel = (context.User as IGuildUser)?.VoiceChannel; if (channel is null) { await context.Reply("You gotta be in a voice channel"); return; } switch (serverConfig.VoiceChannelListType) { case "ALLOW": if (!serverConfig.VoiceChannelList.Contains(channel.Id)) { await context.Reply("You cannot play quotes in that voice channel!"); return; } break; case "BLOCK": if (serverConfig.VoiceChannelList.Contains(channel.Id)) { await context.Reply("You cannot play quotes in that voice channel!"); return; } break; default: break; } statsService.AddToHistory(context.Guild.Id, new HistoryEntry { Category = category, NamedAudio = audio, }); await Play(channel, audio.Audio, CancellationToken.None); }