/// <summary> /// Rebuilds the playtest embed with the most up to date information. /// </summary> /// <returns>EmbedBuilder object containing all relevant information</returns> private EmbedBuilder RebuildEmbed() { var embed = new EmbedBuilder() .WithFooter($"Current CT Time: {DateTime.Now}") .WithColor(new Color(0x752424)); if (_testRequest.TestDate != new DateTime()) { embed.AddField("[0] Test Date:", _testRequest.TestDate, true) .WithColor(new Color(0xa53737)); } if (_testRequest.Emails.Count > 0) { embed.AddField("[1] Emails", string.Join("\n", _testRequest.Emails), true) .WithColor(new Color(0x9a4237)); } if (!string.IsNullOrWhiteSpace(_testRequest.Game)) { embed.AddField("[2] Game", _testRequest.Game, true) .WithColor(new Color(0x8f4d37)); } if (!string.IsNullOrWhiteSpace(_testRequest.MapName)) { embed.AddField("[3] Map Name", _testRequest.MapName, true) .WithColor(new Color(0x8f4d37)); } if (_testRequest.CreatorsDiscord.Count > 0) { embed.AddField("[4] Creators", string.Join("\n", _testRequest.CreatorsDiscord), true) .WithColor(new Color(0x845837)); } if (!string.IsNullOrWhiteSpace(_testRequest.ImgurAlbum)) { embed.AddField("[5] Imgur Album", _testRequest.ImgurAlbum) .WithColor(new Color(0x796337)); } if (!string.IsNullOrWhiteSpace(_testRequest.WorkshopURL)) { embed.AddField("[6] Workshop URL", _testRequest.WorkshopURL) .WithColor(new Color(0x6e6e37)); } if (!string.IsNullOrWhiteSpace(_testRequest.TestType)) { embed.AddField("[7] Type", _testRequest.TestType, true) .WithColor(new Color(0x637937)); } if (!string.IsNullOrWhiteSpace(_testRequest.TestGoals)) { embed.AddField("[8] Description", _testRequest.TestGoals) .WithColor(new Color(0x588437)); } if (_testRequest.Spawns > 0) { embed.AddField("[9] Spawns", _testRequest.Spawns, true) .WithColor(new Color(0x4d8f37)); } if (_testRequest.PreviousTestDate != new DateTime()) { embed.AddField("[10] Previous Test:", _testRequest.PreviousTestDate, true) .WithColor(new Color(0x429a37)); } if (!string.IsNullOrWhiteSpace(_testRequest.Preferredserver)) { embed.AddField("[11] Server:", _testRequest.Preferredserver, true) .WithColor(new Color(0x37a537)); } //Only get new playtest conflict information if we get a new date. But always include it if (!_dateChecked) { _otherRequests = DatabaseUtil.GetAllPlaytestRequests(); _scheduledTests = _calendar.CheckForScheduleConflict(_testRequest.TestDate).Result; _dateChecked = true; } var conflicts = ""; if (_otherRequests != null && _otherRequests.ToList().Count > 0) { foreach (var req in _otherRequests.Where(x => x.TestDate == _testRequest.TestDate)) { conflicts += $"**Map:** `{req.MapName}`\n**Test Date:** `{req.TestDate}`\n**Status:** `Test Requested`\n\n"; } } var modConflicts = ""; if (_scheduledTests != null && _scheduledTests.Items.Count > 0) { foreach (var item in _scheduledTests.Items) { if (item.Summary.Contains("unavailable", StringComparison.OrdinalIgnoreCase)) { modConflicts += $"`{item.Summary.Replace(" - Click for details", "")}`\n"; } else { conflicts += $"**Map:** `{item.Summary}`\n**Test Date:** `{item.Start.DateTime}`\n**Status:** `Scheduled`\n\n"; } } } if (conflicts.Length > 1) { conflicts = conflicts.Trim() + " ```Schedule conflicts have been detected. You may continue to schedule, but your chances of being scheduled are less likely.```"; embed.AddField("Schedule Conflicts Detected", conflicts); embed.WithColor(255, 0, 0); } if (modConflicts.Length > 1) { modConflicts = modConflicts.Trim() + " ```These moderators are unavailable to run this test. You may still continue scheduling, as another moderator may accept this test.```"; embed.AddField("Moderators Unavailable", modConflicts); } return(embed); }