mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
feat: add raw and pt formats to system banner
This commit is contained in:
parent
0552335d1d
commit
48ef34fd65
1 changed files with 20 additions and 13 deletions
|
|
@ -694,24 +694,31 @@ public class SystemEdit
|
||||||
|
|
||||||
var isOwnSystem = target.Id == ctx.System?.Id;
|
var isOwnSystem = target.Id == ctx.System?.Id;
|
||||||
|
|
||||||
if (!ctx.HasNext() && ctx.Message.Attachments.Length == 0)
|
if ((!ctx.HasNext() && ctx.Message.Attachments.Length == 0) || ctx.PeekMatchFormat() != ReplyFormat.Standard)
|
||||||
{
|
{
|
||||||
if ((target.BannerImage?.Trim() ?? "").Length > 0)
|
if ((target.BannerImage?.Trim() ?? "").Length > 0)
|
||||||
{
|
switch (ctx.MatchFormat())
|
||||||
var eb = new EmbedBuilder()
|
{
|
||||||
.Title("System banner image")
|
case ReplyFormat.Raw:
|
||||||
.Image(new Embed.EmbedImage(target.BannerImage));
|
await ctx.Reply($"`{target.BannerImage.TryGetCleanCdnUrl()}`");
|
||||||
|
break;
|
||||||
if (isOwnSystem)
|
case ReplyFormat.Plaintext:
|
||||||
eb.Description("To clear, use `pk;system banner clear`.");
|
var ebP = new EmbedBuilder()
|
||||||
|
.Description($"Showing banner for system {target.NameFor(ctx)}");
|
||||||
await ctx.Reply(embed: eb.Build());
|
await ctx.Reply(text: $"<{target.BannerImage.TryGetCleanCdnUrl()}>", embed: ebP.Build());
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
var ebS = new EmbedBuilder()
|
||||||
|
.Title("System banner image")
|
||||||
|
.Image(new Embed.EmbedImage(target.BannerImage.TryGetCleanCdnUrl()));
|
||||||
|
if (target.Id == ctx.System?.Id)
|
||||||
|
ebS.Description("To clear, use `pk;system banner clear`.");
|
||||||
|
await ctx.Reply(embed: ebS.Build());
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
throw new PKSyntaxError("This system does not have a banner image set."
|
throw new PKSyntaxError("This system does not have a banner image set."
|
||||||
+ (isOwnSystem ? "Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
+ (isOwnSystem ? "Set one by attaching an image to this command, or by passing an image URL or @mention." : ""));
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue