feat: add raw and plaintext formats to system pfp

This commit is contained in:
rladenson 2024-11-18 20:11:12 -07:00 committed by Petal Ladenson
parent 2c4dea29be
commit cd32518c73

View file

@ -565,19 +565,28 @@ 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() {
.Title("System icon") case ReplyFormat.Raw:
.Image(new Embed.EmbedImage(target.AvatarUrl.TryGetCleanCdnUrl())); await ctx.Reply($"`{target.AvatarUrl.TryGetCleanCdnUrl()}`");
if (target.Id == ctx.System?.Id) break;
eb.Description("To clear, use `pk;system icon clear`."); case ReplyFormat.Plaintext:
await ctx.Reply(embed: eb.Build()); 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 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)