feat: add raw and plaintext formats to member avatar, proxy avatar, and guild avatar

This commit is contained in:
rladenson 2024-11-18 18:45:13 -07:00 committed by Petal Ladenson
parent 2d17582e05
commit 2c4dea29be
3 changed files with 35 additions and 6 deletions

View file

@ -86,12 +86,28 @@ public class MemberAvatar
if (location == MemberAvatarLocation.Server)
field += $" (for {ctx.Guild.Name})";
var eb = new EmbedBuilder()
.Title($"{target.NameFor(ctx)}'s {field}")
.Image(new Embed.EmbedImage(currentValue?.TryGetCleanCdnUrl()));
if (target.System == ctx.System?.Id)
eb.Description($"To clear, use `pk;member {target.Reference(ctx)} {location.Command()} clear`.");
await ctx.Reply(embed: eb.Build());
var format = ctx.MatchFormat();
if (format == ReplyFormat.Raw)
{
await ctx.Reply($"`{currentValue?.TryGetCleanCdnUrl()}`");
}
else if (format == ReplyFormat.Plaintext)
{
var eb = new EmbedBuilder()
.Description($"Showing {field} link for member {target.NameFor(ctx)} (`{target.DisplayHid(ctx.Config)}`)");
await ctx.Reply($"<{currentValue?.TryGetCleanCdnUrl()}>", embed: eb.Build());
return;
}
else if (format == ReplyFormat.Standard)
{
var eb = new EmbedBuilder()
.Title($"{target.NameFor(ctx)}'s {field}")
.Image(new Embed.EmbedImage(currentValue?.TryGetCleanCdnUrl()));
if (target.System == ctx.System?.Id)
eb.Description($"To clear, use `pk;member {target.Reference(ctx)} {location.Command()} clear`.");
await ctx.Reply(embed: eb.Build());
}
else throw new PKError("Format Not Recognized");
}
public async Task ServerAvatar(Context ctx, PKMember target)