From cd32518c7308bd8bdc4bda0619ed9a55151729f2 Mon Sep 17 00:00:00 2001 From: rladenson Date: Mon, 18 Nov 2024 20:11:12 -0700 Subject: [PATCH] feat: add raw and plaintext formats to system pfp --- PluralKit.Bot/Commands/SystemEdit.cs | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/PluralKit.Bot/Commands/SystemEdit.cs b/PluralKit.Bot/Commands/SystemEdit.cs index 047901e9..1cb7ca36 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -565,19 +565,28 @@ public class SystemEdit async Task ShowIcon() { if ((target.AvatarUrl?.Trim() ?? "").Length > 0) - { - var eb = new EmbedBuilder() - .Title("System icon") - .Image(new Embed.EmbedImage(target.AvatarUrl.TryGetCleanCdnUrl())); - if (target.Id == ctx.System?.Id) - eb.Description("To clear, use `pk;system icon clear`."); - await ctx.Reply(embed: eb.Build()); - } + switch (ctx.MatchFormat()) + { + case ReplyFormat.Raw: + await ctx.Reply($"`{target.AvatarUrl.TryGetCleanCdnUrl()}`"); + break; + case ReplyFormat.Plaintext: + var ebP = new EmbedBuilder() + .Description($"Showing icon for system {target.NameFor(ctx)}"); + await ctx.Reply(text: $"<{target.AvatarUrl.TryGetCleanCdnUrl()}>", embed: ebP.Build()); + break; + default: + var ebS = new EmbedBuilder() + .Title("System icon") + .Image(new Embed.EmbedImage(target.AvatarUrl.TryGetCleanCdnUrl())); + if (target.Id == ctx.System?.Id) + ebS.Description("To clear, use `pk;system icon clear`."); + await ctx.Reply(embed: ebS.Build()); + break; + } else - { throw new PKSyntaxError( "This system does not have an icon set. Set one by attaching an image to this command, or by passing an image URL or @mention."); - } } if (target != null && target?.Id != ctx.System?.Id)