WIP: port fronters embed to CV2
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled
Build and push Rust service Docker images / rust docker build (push) Has been cancelled
rust checks / cargo fmt (push) Has been cancelled

This commit is contained in:
asleepyskye 2025-09-22 08:18:10 -04:00
parent 651ac6ba5c
commit 9495b95afa
7 changed files with 239 additions and 2 deletions

View file

@ -9,6 +9,7 @@ using NodaTime.TimeZones;
using PluralKit.Core;
namespace PluralKit.Bot;
public class Config
{
private record PaginatedConfigItem(string Key, string Description, string? CurrentValue, string DefaultValue);
@ -130,6 +131,13 @@ public class Config
"disabled"
));
items.Add(new(
"fronter list format",
"Whether to show the fronter list as full or short.",
ctx.Config.FronterListFormat.ToUserString(),
"short"
));
items.Add(new(
"Proxy Switch",
"Switching behavior when proxy tags are used",
@ -591,6 +599,24 @@ public class Config
await ctx.Reply($"Showing color codes on system/member/group cards is now {EnabledDisabled(newVal)}.");
}
public async Task FronterListFormat(Context ctx)
{
var badInputError = "Valid list format settings are `short` or `full`.";
if (ctx.Match("full", "f"))
{
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { FronterListFormat = SystemConfig.ListFormat.Full });
await ctx.Reply($"Fronter lists are now formatted as `full`");
}
else if (ctx.Match("short", "s"))
{
await ctx.Repository.UpdateSystemConfig(ctx.System.Id, new() { FronterListFormat = SystemConfig.ListFormat.Short });
await ctx.Reply($"Fronter lists are now formatted as `short`");
}
else throw new PKError(badInputError);
}
public async Task ProxySwitch(Context ctx)
{
if (!ctx.HasNext())

View file

@ -23,7 +23,12 @@ public class SystemFront
var sw = await ctx.Repository.GetLatestSwitch(system.Id);
if (sw == null) throw Errors.NoRegisteredSwitches;
await ctx.Reply(embed: await _embeds.CreateFronterEmbed(sw, ctx.Zone, ctx.LookupContextFor(system.Id)));
if (ctx.MatchFlag("show-embed", "se"))
{
await ctx.Reply(text: EmbedService.LEGACY_EMBED_WARNING, embed: await _embeds.CreateFronterEmbed(sw, ctx.Zone, ctx.LookupContextFor(system.Id)));
return;
}
await ctx.Reply(components: await _embeds.CreateFronterMessageComponents(ctx, system, sw, ctx.LookupContextFor(system.Id)));
}
public async Task SystemFrontHistory(Context ctx, PKSystem system)