mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 17:20:14 +00:00
Fix front history lookup with very long switches
This commit is contained in:
parent
0226e73d88
commit
520e6f140c
1 changed files with 6 additions and 2 deletions
|
|
@ -128,17 +128,21 @@ namespace PluralKit.Bot {
|
||||||
var switchSince = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp;
|
var switchSince = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp;
|
||||||
|
|
||||||
// If this isn't the latest switch, we also show duration
|
// If this isn't the latest switch, we also show duration
|
||||||
|
string stringToAdd;
|
||||||
if (lastSw != null)
|
if (lastSw != null)
|
||||||
{
|
{
|
||||||
// Calculate the time between the last switch (that we iterated - ie. the next one on the timeline) and the current one
|
// Calculate the time between the last switch (that we iterated - ie. the next one on the timeline) and the current one
|
||||||
var switchDuration = lastSw.Timestamp - sw.Timestamp;
|
var switchDuration = lastSw.Timestamp - sw.Timestamp;
|
||||||
outputStr += $"**{membersStr}** ({Formats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))}, {Formats.DurationFormat.Format(switchSince)} ago, for {Formats.DurationFormat.Format(switchDuration)})\n";
|
stringToAdd = $"**{membersStr}** ({Formats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))}, {Formats.DurationFormat.Format(switchSince)} ago, for {Formats.DurationFormat.Format(switchDuration)})\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outputStr += $"**{membersStr}** ({Formats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))}, {Formats.DurationFormat.Format(switchSince)} ago)\n";
|
stringToAdd = $"**{membersStr}** ({Formats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))}, {Formats.DurationFormat.Format(switchSince)} ago)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (outputStr.Length + stringToAdd.Length > EmbedBuilder.MaxDescriptionLength) break;
|
||||||
|
outputStr += stringToAdd;
|
||||||
|
|
||||||
lastSw = sw;
|
lastSw = sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue