feat: add raw and plaintext formats to system pfp

This commit is contained in:
rladenson 2024-11-18 20:11:12 -07:00
parent ece884f83a
commit 3d118b9ada

View file

@ -565,20 +565,29 @@ public class SystemEdit
async Task ShowIcon() async Task ShowIcon()
{ {
if ((target.AvatarUrl?.Trim() ?? "").Length > 0) if ((target.AvatarUrl?.Trim() ?? "").Length > 0)
switch (ctx.MatchFormat())
{ {
var eb = new EmbedBuilder() 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") .Title("System icon")
.Image(new Embed.EmbedImage(target.AvatarUrl.TryGetCleanCdnUrl())); .Image(new Embed.EmbedImage(target.AvatarUrl.TryGetCleanCdnUrl()));
if (target.Id == ctx.System?.Id) if (target.Id == ctx.System?.Id)
eb.Description("To clear, use `pk;system icon clear`."); ebS.Description("To clear, use `pk;system icon clear`.");
await ctx.Reply(embed: eb.Build()); await ctx.Reply(embed: ebS.Build());
break;
} }
else else
{
throw new PKSyntaxError( 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."); "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) if (target != null && target?.Id != ctx.System?.Id)
{ {