public virtual async Task ShowQueueAsync() { using (var db = new Database()) { var lobby = db.GetLobby(Context.Channel); if (lobby == null) { await SimpleEmbedAsync("Current channel is not a lobby.", Color.Red); return; } var game = db.GetLatestGame(lobby); if (game != null) { if (game.GameState == GameState.Picking) { var team1 = db.GetTeam1(game).ToList(); var team2 = db.GetTeam2(game).ToList(); var gameEmbed = new EmbedBuilder { Title = $"Game: #{game.GameId} - Current Teams." }; var t1Users = LobbyService.GetMentionList(LobbyService.GetUserList(Context.Guild, team1.Select(x => x.UserId))); var t2Users = LobbyService.GetMentionList(LobbyService.GetUserList(Context.Guild, team2.Select(x => x.UserId))); var t1c = db.GetTeamCaptain(Context.Guild.Id, Context.Channel.Id, game.GameId, 1); var t2c = db.GetTeamCaptain(Context.Guild.Id, Context.Channel.Id, game.GameId, 2); var queue = db.GetQueue(game); var remainingPlayers = LobbyService.GetMentionList(LobbyService.GetUserList(Context.Guild, queue.Where(x => !team1.Any(y => y.UserId == x.UserId) && !team2.Any(y => y.UserId == x.UserId)).Select(x => x.UserId))); gameEmbed.AddField("Team 1", $"Captain: {MentionUtils.MentionUser(t1c.UserId)}\n{string.Join("\n", t1Users)}"); gameEmbed.AddField("Team 2", $"Captain: {MentionUtils.MentionUser(t2c.UserId)}\n{string.Join("\n", t2Users)}"); if (remainingPlayers.Any()) { gameEmbed.AddField("Remaining Players", string.Join("\n", remainingPlayers)); } var teamCaptain = game.Picks % 2 == 0 ? t1c : t2c; if (game.PickOrder == CaptainPickOrder.PickOne) { gameEmbed.AddField("Captain Currently Picking", $"{MentionUtils.MentionUser(teamCaptain.UserId)} can pick **1** player for this pick."); } else if (game.PickOrder == CaptainPickOrder.PickTwo) { if (game.Picks == 1 || game.Picks == 2) { gameEmbed.AddField("Captain Currently Picking", $"{MentionUtils.MentionUser(teamCaptain.UserId)} can pick **2** players for this pick."); } else { gameEmbed.AddField("Captain Currently Picking", $"{MentionUtils.MentionUser(teamCaptain.UserId)} can pick **1** player for this pick."); } } await ReplyAsync(gameEmbed); return; } } var lobbyQueue = db.GetQueue(lobby).ToList(); if (lobbyQueue.Count > 0) { if (lobby.HideQueue) { await Context.Message.DeleteAsync(); await SimpleEmbedAsync($"**[{lobbyQueue.Count}/{lobby.PlayersPerTeam * 2}]**", Color.Blue); return; } var embed = new EmbedBuilder { Color = Color.Blue }; embed.Title = $"{Context.Channel.Name} [{lobbyQueue.Count}/{lobby.PlayersPerTeam * 2}]"; embed.Description = $"Game: #{(game?.GameId == null ? 0 : game.GameId) + 1}\n" + string.Join("\n", lobbyQueue.Select(x => MentionUtils.MentionUser(x.UserId))); await ReplyAsync(embed); } else { await SimpleEmbedAsync("The queue is empty.", Color.Blue); } } }