feat: add raw and pt format to group icon

This commit is contained in:
rladenson 2024-11-18 22:44:13 -07:00 committed by Petal Ladenson
parent cd32518c73
commit 1ae6c8ff54

View file

@ -312,22 +312,29 @@ public class Groups
ctx.CheckSystemPrivacy(target.System, target.IconPrivacy); ctx.CheckSystemPrivacy(target.System, target.IconPrivacy);
if ((target.Icon?.Trim() ?? "").Length > 0) if ((target.Icon?.Trim() ?? "").Length > 0)
switch (ctx.MatchFormat())
{ {
var eb = new EmbedBuilder() case ReplyFormat.Raw:
await ctx.Reply($"`{target.Icon.TryGetCleanCdnUrl()}`");
break;
case ReplyFormat.Plaintext:
var ebP = new EmbedBuilder()
.Description($"Showing avatar for group {target.NameFor(ctx)}");
await ctx.Reply(text: $"<{target.Icon.TryGetCleanCdnUrl()}>", embed: ebP.Build());
break;
default:
var ebS = new EmbedBuilder()
.Title("Group icon") .Title("Group icon")
.Image(new Embed.EmbedImage(target.Icon.TryGetCleanCdnUrl())); .Image(new Embed.EmbedImage(target.Icon.TryGetCleanCdnUrl()));
if (target.System == ctx.System?.Id) if (target.System == ctx.System?.Id)
eb.Description($"To clear, use `pk;group {target.Reference(ctx)} icon -clear`."); ebS.Description($"To clear, use `pk;group {target.Reference(ctx)} icon -clear`.");
await ctx.Reply(embed: ebS.Build());
await ctx.Reply(embed: eb.Build()); break;
} }
else else
{
throw new PKSyntaxError( throw new PKSyntaxError(
"This group does not have an avatar set. Set one by attaching an image to this command, or by passing an image URL or @mention."); "This group does not have an avatar set. Set one by attaching an image to this command, or by passing an image URL or @mention.");
} }
}
if (ctx.MatchClear()) if (ctx.MatchClear())
await ClearIcon(); await ClearIcon();