Refactor date/time format constants

This commit is contained in:
Ske
2019-06-15 12:33:24 +02:00
parent fa5a616716
commit f4a53ce815
7 changed files with 24 additions and 21 deletions

View File

@@ -71,13 +71,13 @@ namespace PluralKit.Bot {
return eb.Build();
}
public Embed CreateFronterEmbed(PKSwitch sw, ICollection<PKMember> members)
public Embed CreateFronterEmbed(PKSwitch sw, ICollection<PKMember> members, DateTimeZone zone)
{
var timeSinceSwitch = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp;
return new EmbedBuilder()
.WithColor(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? Color.Blue)
.AddField("Current fronter", members.Count > 0 ? string.Join(", ", members.Select(m => m.Name)) : "*(no fronter)*", true)
.AddField("Since", $"{sw.Timestamp.ToString(Formats.DateTimeFormat, null)} ({timeSinceSwitch.ToString(Formats.DurationFormat, null)} ago)", true)
.AddField("Since", $"{Formats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))} ({Formats.DurationFormat.Format(timeSinceSwitch)} ago)", true)
.Build();
}
}