mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add raw and pt formats to member banners
This commit is contained in:
parent
8db785f98a
commit
ba279612ca
1 changed files with 20 additions and 10 deletions
|
|
@ -229,18 +229,28 @@ public class MemberEdit
|
||||||
async Task ShowBannerImage()
|
async Task ShowBannerImage()
|
||||||
{
|
{
|
||||||
if ((target.BannerImage?.Trim() ?? "").Length > 0)
|
if ((target.BannerImage?.Trim() ?? "").Length > 0)
|
||||||
{
|
switch (ctx.MatchFormat())
|
||||||
var eb = new EmbedBuilder()
|
{
|
||||||
.Title($"{target.NameFor(ctx)}'s banner image")
|
case ReplyFormat.Raw:
|
||||||
.Image(new Embed.EmbedImage(target.BannerImage))
|
await ctx.Reply($"`{target.BannerImage.TryGetCleanCdnUrl()}`");
|
||||||
.Description($"To clear, use `pk;member {target.Reference(ctx)} banner clear`.");
|
break;
|
||||||
await ctx.Reply(embed: eb.Build());
|
case ReplyFormat.Plaintext:
|
||||||
}
|
var ebP = new EmbedBuilder()
|
||||||
|
.Description($"Showing banner for member {target.NameFor(ctx)} (`{target.Id}`)");
|
||||||
|
await ctx.Reply(text: $"<{target.BannerImage.TryGetCleanCdnUrl()}>", embed: ebP.Build());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
var ebS = new EmbedBuilder()
|
||||||
|
.Title($"{target.NameFor(ctx)}'s banner image")
|
||||||
|
.Image(new Embed.EmbedImage(target.BannerImage.TryGetCleanCdnUrl()));
|
||||||
|
if (target.System == ctx.System?.Id)
|
||||||
|
ebS.Description($"To clear, use `pk;member {target.Reference(ctx)} banner clear`.");
|
||||||
|
await ctx.Reply(embed: ebS.Build());
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
throw new PKSyntaxError(
|
throw new PKSyntaxError(
|
||||||
"This member does not have a banner image set. Set one by attaching an image to this command, or by passing an image URL.");
|
"This member does not have a banner image set." + ((target.System == ctx.System?.Id) ? " Set one by attaching an image to this command, or by passing an image URL." : ""));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.MatchClear() && await ctx.ConfirmClear("this member's banner image"))
|
if (ctx.MatchClear() && await ctx.ConfirmClear("this member's banner image"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue