private string CreateRaidText(RaidParticipation raid) { StringBuilder participationSB = new StringBuilder(); CalculateParticipationBlock(raid, participationSB, out string tps); StringBuilder sb = new StringBuilder(); // sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Subscribed")) + $":</b> {tps}"); if (!string.IsNullOrWhiteSpace(raid.Raid.Gym)) { string timestr = String.Empty; if (raid.Raid.RaidUnlockTime != default && raid.Raid.RaidUnlockTime >= DateTime.UtcNow) { timestr += TimeService.AsShortTime(raid.Raid.RaidUnlockTime); } else if (raid.Raid.RaidUnlockTime != default && raid.Raid.RaidUnlockTime < DateTime.UtcNow) { timestr += I18N.GetString("now"); } if (raid.Raid.RaidEndTime != default && raid.Raid.RaidEndTime >= DateTime.UtcNow) { timestr += (timestr.Length > 0 ? "-" : String.Empty) + TimeService.AsShortTime(raid.Raid.RaidEndTime); } string url = $"{Settings.BotAddress}raids/{raid.PublicID}"; sb.AppendLine($"<b>{MessageUtils.HtmlEscape(raid.Raid.Gym)} ({raid.NumberOfParticipants()} - {timestr})</b>"); sb.AppendLine($"<a href=\"{url}\">Online inschrijven (nieuw)</a>"); } if (!string.IsNullOrWhiteSpace(raid.Raid.Remarks)) { sb.AppendLine($"{MessageUtils.HtmlEscape(raid.Raid.Remarks)}"); } if (!string.IsNullOrWhiteSpace(raid.Raid.Raid)) { sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Raid")) + $":</b> {MessageUtils.HtmlEscape(raid.Raid.Raid)}"); } if (raid.Raid.Alignment != Team.Unknown) { sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Alignment")) + $":</b> {MessageUtils.HtmlEscape(raid.Raid.Alignment.AsReadableString())}"); } if (!string.IsNullOrWhiteSpace(raid.Raid.Address)) { sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Address")) + $":</b> {MessageUtils.HtmlEscape(raid.Raid.Address)}"); } if (null != raid.Raid.Location) { string lat = raid.Raid.Location.Latitude.ToString(CultureInfo.InvariantCulture); string lon = raid.Raid.Location.Longitude.ToString(CultureInfo.InvariantCulture); string externalurls = String.Empty; if (raid.Raid.Sources != null) { foreach (var source in raid.Raid.Sources.Where(x => !string.IsNullOrEmpty(x.URL)).ToArray()) { externalurls += $"<a href=\"{source.URL}\">" + _HTML_(source.SourceID) + $"</a>, "; } } sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Links")) + $":</b> ({externalurls}<a href=\"https://www.google.com/maps/?daddr={lat},{lon}\">" + _HTML_(I18N.GetString("route")) + $"</a>, <a href=\"https://ingress.com/intel?ll={lat},{lon}&z=17\">" + _HTML_(I18N.GetString("portal map")) + $"</a>)"); } sb.Append(participationSB); var naySayers = raid.Rejected.Select(x => x).OrderBy(x => x.ShortName()); if (naySayers.Any()) { sb.AppendLine(String.Empty); var str = string.Join(", ", naySayers.Select(x => $"{x.ShortName()}")); sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Declined")) + $":</b> {str}"); } var userSettingsCollection = DB.GetCollection <UserSettings>(); var undecided = raid.Maybe.Select(x => x).OrderBy(x => x.ShortName()); if (undecided.Any()) { sb.AppendLine(String.Empty); var str = string.Join(", ", undecided.Select(x => { string name = x.ShortName().TrimStart('@'); var userRecord = userSettingsCollection.Find(y => y.User.ID == x.ID).FirstOrDefault(); if (!string.IsNullOrWhiteSpace(userRecord?.Alias)) { name = userRecord.Alias; } if (userRecord?.Level > 0) { name += $" (" + _HTML_(I18N.GetString("level")) + $" {userRecord?.Level})"; } return(name); })); sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Maybe")) + $":</b> {str}"); } var alreadyDone = raid.Done.Select(x => x).OrderBy(x => x.ShortName()); if (alreadyDone.Any()) { sb.AppendLine(String.Empty); var str = string.Join(", ", alreadyDone.Select(x => $"{x.ShortName()}")); sb.AppendLine($"<b>" + _HTML_(I18N.GetString("Done")) + $":</b> {str}"); } sb.AppendLine($"\n#raid updated: <i>{TimeService.AsFullTime(DateTime.UtcNow)}</i>"); return(sb.ToString()); }