From 0552335d1d2f1499e158d3c3eaa8175a4e73c888 Mon Sep 17 00:00:00 2001 From: rladenson Date: Mon, 18 Nov 2024 23:18:27 -0700 Subject: [PATCH] feat: add raw and pt format to system servericon --- 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 3e7d4dec..9ebb6f0f 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -648,19 +648,28 @@ public class SystemEdit var settings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id); if ((settings.AvatarUrl?.Trim() ?? "").Length > 0) - { - var eb = new EmbedBuilder() - .Title("System server icon") - .Image(new Embed.EmbedImage(settings.AvatarUrl.TryGetCleanCdnUrl())); - if (target.Id == ctx.System?.Id) - eb.Description("To clear, use `pk;system servericon clear`."); - await ctx.Reply(embed: eb.Build()); - } + switch (ctx.MatchFormat()) + { + case ReplyFormat.Raw: + await ctx.Reply($"`{settings.AvatarUrl.TryGetCleanCdnUrl()}`"); + break; + case ReplyFormat.Plaintext: + var ebP = new EmbedBuilder() + .Description($"Showing icon for system {target.NameFor(ctx)}"); + await ctx.Reply(text: $"<{settings.AvatarUrl.TryGetCleanCdnUrl()}>", embed: ebP.Build()); + break; + default: + var ebS = new EmbedBuilder() + .Title("System server icon") + .Image(new Embed.EmbedImage(settings.AvatarUrl.TryGetCleanCdnUrl())); + if (target.Id == ctx.System?.Id) + ebS.Description("To clear, use `pk;system servericon clear`."); + await ctx.Reply(embed: ebS.Build()); + break; + } else - { throw new PKSyntaxError( "This system does not have a icon specific to this server. Set one by attaching an image to this command, or by passing an image URL or @mention."); - } } ctx.CheckGuildContext();