feat(bot): add system guild icon & guild name (#554)

This commit is contained in:
rladenson 2023-07-19 12:48:04 +12:00 committed by Iris System
parent d12cd481f6
commit 3045c5e307
22 changed files with 337 additions and 28 deletions

View file

@ -44,10 +44,17 @@ public class SystemFront
.Scan(new FrontHistoryEntry(null, null),
(lastEntry, newSwitch) => new FrontHistoryEntry(lastEntry.ThisSwitch?.Timestamp, newSwitch));
var embedTitle = system.Name != null
? $"Front history of {system.Name} (`{system.Hid}`)"
var embedTitle = system.NameFor(ctx) != null
? $"Front history of {system.NameFor(ctx)} (`{system.Hid}`)"
: $"Front history of `{system.Hid}`";
if (ctx.Guild != null)
{
var guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id);
if (guildSettings.DisplayName != null)
embedTitle = $"Front history of {guildSettings.DisplayName} (`{system.Hid}`)";
}
var showMemberId = ctx.MatchFlag("with-id", "wid");
await ctx.Paginate(
@ -127,10 +134,13 @@ public class SystemFront
if (rangeStart.Value.ToInstant() > now) throw Errors.FrontPercentTimeInFuture;
var title = new StringBuilder("Frontpercent of ");
var guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id);
if (group != null)
title.Append($"{group.NameFor(ctx)} (`{group.Hid}`)");
else if (system.Name != null)
title.Append($"{system.Name} (`{system.Hid}`)");
else if (guildSettings.DisplayName != null)
title.Append($"{guildSettings.DisplayName} (`{system.Hid}`)");
else if (system.NameFor(ctx) != null)
title.Append($"{system.NameFor(ctx)} (`{system.Hid}`)");
else
title.Append($"`{system.Hid}`");