improve log header if no system is known

This commit is contained in:
Florian Stinglmayr 2022-11-25 14:53:04 +01:00
parent e0e7cb5792
commit 61f1b10f29
2 changed files with 22 additions and 3 deletions

View File

@ -34,9 +34,18 @@ public class DiscordLogGenerator {
protected virtual string GenerateObjectiveHeader(Objective objective) {
StringBuilder log = new StringBuilder();
string location;
if (!string.IsNullOrEmpty(objective.System) && !string.IsNullOrEmpty(objective.Faction)) {
location = string.Format("{0}, {1}", objective.System, objective.Faction);
} else if (!string.IsNullOrEmpty(objective.System)) {
location = objective.System;
} else {
location = "Unknown Location";
}
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
log.AppendFormat("**Location:** {0}, {1}\n", objective.System, objective.Faction);
log.AppendFormat("**Faction:** {0}\n", objective.Faction);
log.AppendFormat("**Target:** {0}\n", location);
log.AppendLine("");
log.AppendLine("```");

View File

@ -34,7 +34,17 @@ public class NonaDiscordLog : DiscordLogGenerator {
protected override string GenerateObjectiveHeader(Objective objective) {
StringBuilder log = new StringBuilder();
log.AppendFormat(":globe_with_meridians: `Location:` {0}, {1}\n", objective.System, objective.Faction);
string location;
if (!string.IsNullOrEmpty(objective.System) && !string.IsNullOrEmpty(objective.Faction)) {
location = string.Format("{0}, {1}", objective.System, objective.Faction);
} else if (!string.IsNullOrEmpty(objective.System)) {
location = objective.System;
} else {
location = "Unknown Location";
}
log.AppendFormat(":globe_with_meridians: `Target:` {0}\n", location);
log.Append(":clipboard: `Conducted:`\n");
log.Append("```");