mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat(bot): add -plaintext flag alongside -raw
This commit is contained in:
parent
3d9be096cb
commit
23fe904464
5 changed files with 322 additions and 162 deletions
|
|
@ -91,8 +91,12 @@ public static class ContextArgumentsExt
|
|||
public static bool MatchClear(this Context ctx)
|
||||
=> ctx.Match("clear", "reset", "default") || ctx.MatchFlag("c", "clear");
|
||||
|
||||
public static bool MatchRaw(this Context ctx) =>
|
||||
ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw");
|
||||
public static ReplyFormat MatchFormat(this Context ctx)
|
||||
{
|
||||
if (ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw")) return ReplyFormat.Raw;
|
||||
if (ctx.Match("pt", "plaintext") || ctx.MatchFlag("pt", "plaintext")) return ReplyFormat.Plaintext;
|
||||
return ReplyFormat.Standard;
|
||||
}
|
||||
|
||||
public static bool MatchToggle(this Context ctx, bool? defaultValue = null)
|
||||
{
|
||||
|
|
@ -185,3 +189,10 @@ public static class ContextArgumentsExt
|
|||
return groups;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ReplyFormat
|
||||
{
|
||||
Standard,
|
||||
Raw,
|
||||
Plaintext
|
||||
}
|
||||
|
|
@ -132,22 +132,30 @@ public class Groups
|
|||
|
||||
// No perms check, display name isn't covered by member privacy
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.DisplayName == null)
|
||||
{
|
||||
await ctx.Reply(noDisplayNameSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.DisplayName}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing displayname for group {target.Reference(ctx)}");
|
||||
await ctx.Reply(target.DisplayName, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.DisplayName == null)
|
||||
{
|
||||
await ctx.Reply(noDisplayNameSetMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Field(new Embed.Field("Name", target.Name))
|
||||
|
|
@ -165,7 +173,6 @@ public class Groups
|
|||
eb.Footer(new Embed.EmbedFooter($"Using {target.DisplayName.Length}/{Limits.MaxGroupNameLength} characters."));
|
||||
|
||||
await ctx.Reply(embed: eb.Build());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -201,20 +208,31 @@ public class Groups
|
|||
noDescriptionSetMessage +=
|
||||
$" To set one, type `pk;group {target.Reference(ctx)} description <description>`.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Description == null)
|
||||
{
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.Description}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing description for group {target.Reference(ctx)}");
|
||||
await ctx.Reply(target.Description, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Description == null)
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("Group description")
|
||||
.Description(target.Description)
|
||||
|
|
@ -385,7 +403,7 @@ public class Groups
|
|||
public async Task GroupColor(Context ctx, PKGroup target)
|
||||
{
|
||||
var isOwnSystem = ctx.System?.Id == target.System;
|
||||
var matchedRaw = ctx.MatchRaw();
|
||||
var matchedFormat = ctx.MatchFormat();
|
||||
var matchedClear = ctx.MatchClear();
|
||||
|
||||
if (!isOwnSystem || !(ctx.HasNext() || matchedClear))
|
||||
|
|
@ -393,8 +411,10 @@ public class Groups
|
|||
if (target.Color == null)
|
||||
await ctx.Reply(
|
||||
"This group does not have a color set." + (isOwnSystem ? $" To set one, type `pk;group {target.Reference(ctx)} color <color>`." : ""));
|
||||
else if (matchedRaw)
|
||||
else if (matchedFormat == ReplyFormat.Raw)
|
||||
await ctx.Reply("```\n#" + target.Color + "\n```");
|
||||
else if (matchedFormat == ReplyFormat.Plaintext)
|
||||
await ctx.Reply(target.Color);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("Group color")
|
||||
|
|
|
|||
|
|
@ -70,20 +70,31 @@ public class MemberEdit
|
|||
noDescriptionSetMessage +=
|
||||
$" To set one, type `pk;member {target.Reference(ctx)} description <description>`.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Description == null)
|
||||
{
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.Description}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing description for member {target.Reference(ctx)}");
|
||||
await ctx.Reply(target.Description, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Description == null)
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("Member description")
|
||||
.Description(target.Description)
|
||||
|
|
@ -126,20 +137,31 @@ public class MemberEdit
|
|||
|
||||
ctx.CheckSystemPrivacy(target.System, target.PronounPrivacy);
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Pronouns == null)
|
||||
{
|
||||
await ctx.Reply(noPronounsSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.Pronouns}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing pronouns for member {target.Reference(ctx)}");
|
||||
await ctx.Reply(target.Pronouns, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Pronouns == null)
|
||||
await ctx.Reply(noPronounsSetMessage);
|
||||
else
|
||||
await ctx.Reply(
|
||||
$"**{target.NameFor(ctx)}**'s pronouns are **{target.Pronouns}**.\nTo print the pronouns with formatting, type `pk;member {target.Reference(ctx)} pronouns -raw`."
|
||||
+ (ctx.System?.Id == target.System
|
||||
|
|
@ -232,7 +254,7 @@ public class MemberEdit
|
|||
public async Task Color(Context ctx, PKMember target)
|
||||
{
|
||||
var isOwnSystem = ctx.System?.Id == target.System;
|
||||
var matchedRaw = ctx.MatchRaw();
|
||||
var matchedFormat = ctx.MatchFormat();
|
||||
var matchedClear = ctx.MatchClear();
|
||||
|
||||
if (!isOwnSystem || !(ctx.HasNext() || matchedClear))
|
||||
|
|
@ -240,8 +262,10 @@ public class MemberEdit
|
|||
if (target.Color == null)
|
||||
await ctx.Reply(
|
||||
"This member does not have a color set." + (isOwnSystem ? $" To set one, type `pk;member {target.Reference(ctx)} color <color>`." : ""));
|
||||
else if (matchedRaw)
|
||||
else if (matchedFormat == ReplyFormat.Raw)
|
||||
await ctx.Reply("```\n#" + target.Color + "\n```");
|
||||
else if (matchedFormat == ReplyFormat.Plaintext)
|
||||
await ctx.Reply(target.Color);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("Member color")
|
||||
|
|
@ -388,14 +412,28 @@ public class MemberEdit
|
|||
|
||||
// No perms check, display name isn't covered by member privacy
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if what's next is "raw"/"plaintext" we need to check for null
|
||||
if (format != ReplyFormat.Standard)
|
||||
if (target.DisplayName == null)
|
||||
{
|
||||
await ctx.Reply(noDisplayNameSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.DisplayName}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing displayname for member {target.Reference(ctx)}");
|
||||
await ctx.Reply(target.DisplayName, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
|
|
@ -450,14 +488,28 @@ public class MemberEdit
|
|||
// No perms check, display name isn't covered by member privacy
|
||||
var memberGuildConfig = await ctx.Repository.GetMemberGuild(ctx.Guild.Id, target.Id);
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if what's next is "raw"/"plaintext" we need to check for null
|
||||
if (format != ReplyFormat.Standard)
|
||||
if (memberGuildConfig.DisplayName == null)
|
||||
{
|
||||
await ctx.Reply(noServerNameSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{memberGuildConfig.DisplayName}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing servername for member {target.Reference(ctx)}");
|
||||
await ctx.Reply(memberGuildConfig.DisplayName, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -352,7 +352,9 @@ public class ProxiedMessage
|
|||
else if (!await ctx.CheckPermissionsInGuildChannel(channel, PermissionSet.ViewChannel))
|
||||
showContent = false;
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
if (format != ReplyFormat.Standard)
|
||||
{
|
||||
var discordMessage = await _rest.GetMessageOrNull(message.Message.Channel, message.Message.Mid);
|
||||
if (discordMessage == null || !showContent)
|
||||
|
|
@ -365,6 +367,8 @@ public class ProxiedMessage
|
|||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```{content}```");
|
||||
|
||||
if (Regex.IsMatch(content, "```.*```", RegexOptions.Singleline))
|
||||
|
|
@ -378,10 +382,19 @@ public class ProxiedMessage
|
|||
},
|
||||
new[] { new MultipartFile("message.txt", stream, null, null, null) });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing contents of message {message.Message.Mid}");
|
||||
await ctx.Reply(content, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isDelete)
|
||||
{
|
||||
if (!showContent)
|
||||
|
|
|
|||
|
|
@ -37,24 +37,35 @@ public class SystemEdit
|
|||
if (isOwnSystem)
|
||||
noNameSetMessage += " Type `pk;system name <name>` to set one.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Name == null)
|
||||
{
|
||||
if (target.Name != null)
|
||||
await ctx.Reply($"```\n{target.Name}\n```");
|
||||
else
|
||||
await ctx.Reply(noNameSetMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"` ``\n{target.Name}\n` ``");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing name for system {target.DisplayHid()}");
|
||||
await ctx.Reply(target.Name, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Name != null)
|
||||
await ctx.Reply(
|
||||
$"{(isOwnSystem ? "Your" : "This")} system's name is currently **{target.Name}**."
|
||||
+ (isOwnSystem ? " Type `pk;system name -clear` to clear it." : "")
|
||||
+ $" Using {target.Name.Length}/{Limits.MaxSystemNameLength} characters.");
|
||||
else
|
||||
await ctx.Reply(noNameSetMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -91,24 +102,35 @@ public class SystemEdit
|
|||
|
||||
var settings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id);
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (settings.DisplayName == null)
|
||||
{
|
||||
if (settings.DisplayName != null)
|
||||
await ctx.Reply($"```\n{settings.DisplayName}\n```");
|
||||
else
|
||||
await ctx.Reply(noNameSetMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"` ``\n{settings.DisplayName}\n` ``");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing servername for system {target.DisplayHid()}");
|
||||
await ctx.Reply(settings.DisplayName, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (settings.DisplayName != null)
|
||||
await ctx.Reply(
|
||||
$"{(isOwnSystem ? "Your" : "This")} system's name for this server is currently **{settings.DisplayName}**."
|
||||
+ (isOwnSystem ? " Type `pk;system servername -clear` to clear it." : "")
|
||||
+ $" Using {settings.DisplayName.Length}/{Limits.MaxSystemNameLength} characters.");
|
||||
else
|
||||
await ctx.Reply(noNameSetMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -143,20 +165,31 @@ public class SystemEdit
|
|||
if (isOwnSystem)
|
||||
noDescriptionSetMessage += " To set one, type `pk;s description <description>`.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Description == null)
|
||||
{
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"` ``\n{target.Description}\n` ``");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing description for system {target.DisplayHid()}");
|
||||
await ctx.Reply(target.Description, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Description == null)
|
||||
await ctx.Reply(noDescriptionSetMessage);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("System description")
|
||||
.Description(target.Description)
|
||||
|
|
@ -191,7 +224,7 @@ public class SystemEdit
|
|||
public async Task Color(Context ctx, PKSystem target)
|
||||
{
|
||||
var isOwnSystem = ctx.System?.Id == target.Id;
|
||||
var matchedRaw = ctx.MatchRaw();
|
||||
var matchedFormat = ctx.MatchFormat();
|
||||
var matchedClear = ctx.MatchClear();
|
||||
|
||||
if (!isOwnSystem || !(ctx.HasNext() || matchedClear))
|
||||
|
|
@ -199,8 +232,10 @@ public class SystemEdit
|
|||
if (target.Color == null)
|
||||
await ctx.Reply(
|
||||
"This system does not have a color set." + (isOwnSystem ? " To set one, type `pk;system color <color>`." : ""));
|
||||
else if (matchedRaw)
|
||||
else if (matchedFormat == ReplyFormat.Raw)
|
||||
await ctx.Reply("```\n#" + target.Color + "\n```");
|
||||
else if (matchedFormat == ReplyFormat.Plaintext)
|
||||
await ctx.Reply(target.Color);
|
||||
else
|
||||
await ctx.Reply(embed: new EmbedBuilder()
|
||||
.Title("System color")
|
||||
|
|
@ -246,20 +281,31 @@ public class SystemEdit
|
|||
? "You currently have no system tag set. To set one, type `pk;s tag <tag>`."
|
||||
: "This system currently has no system tag set.";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Tag == null)
|
||||
{
|
||||
await ctx.Reply(noTagSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.Tag}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing tag for system {target.DisplayHid()}");
|
||||
await ctx.Reply(target.Tag, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Tag == null)
|
||||
await ctx.Reply(noTagSetMessage);
|
||||
else
|
||||
await ctx.Reply($"{(isOwnSystem ? "Your" : "This system's")} current system tag is {target.Tag.AsCode()}."
|
||||
+ (isOwnSystem ? "To change it, type `pk;s tag <tag>`. To clear it, type `pk;s tag -clear`." : ""));
|
||||
return;
|
||||
|
|
@ -296,15 +342,22 @@ public class SystemEdit
|
|||
|
||||
var settings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id);
|
||||
|
||||
async Task Show(bool raw = false)
|
||||
async Task Show(ReplyFormat format = ReplyFormat.Standard)
|
||||
{
|
||||
if (settings.Tag != null)
|
||||
{
|
||||
if (raw)
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```{settings.Tag}```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing servertag for system {target.DisplayHid()}");
|
||||
await ctx.Reply(settings.Tag, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
var msg = $"Your current system tag in '{ctx.Guild.Name}' is {settings.Tag.AsCode()}";
|
||||
if (!settings.TagEnabled)
|
||||
|
|
@ -400,8 +453,8 @@ public class SystemEdit
|
|||
await EnableDisable(false);
|
||||
else if (ctx.Match("enable") || ctx.MatchFlag("enable"))
|
||||
await EnableDisable(true);
|
||||
else if (ctx.MatchRaw())
|
||||
await Show(true);
|
||||
else if (ctx.MatchFormat() != ReplyFormat.Standard)
|
||||
await Show(ctx.MatchFormat());
|
||||
else if (!ctx.HasNext(false))
|
||||
await Show();
|
||||
else
|
||||
|
|
@ -418,20 +471,31 @@ public class SystemEdit
|
|||
if (isOwnSystem)
|
||||
noPronounsSetMessage += " To set some, type `pk;system pronouns <pronouns>`";
|
||||
|
||||
if (ctx.MatchRaw())
|
||||
{
|
||||
var format = ctx.MatchFormat();
|
||||
|
||||
// if there's nothing next or what's next is "raw"/"plaintext" we're doing a query, so check for null
|
||||
if (!ctx.HasNext(false) || format != ReplyFormat.Standard)
|
||||
if (target.Pronouns == null)
|
||||
{
|
||||
await ctx.Reply(noPronounsSetMessage);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == ReplyFormat.Raw)
|
||||
{
|
||||
await ctx.Reply($"```\n{target.Pronouns}\n```");
|
||||
return;
|
||||
}
|
||||
if (format == ReplyFormat.Plaintext)
|
||||
{
|
||||
var eb = new EmbedBuilder()
|
||||
.Description($"Showing pronouns for system {target.DisplayHid()}");
|
||||
await ctx.Reply(target.Pronouns, embed: eb.Build());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx.HasNext(false))
|
||||
{
|
||||
if (target.Pronouns == null)
|
||||
await ctx.Reply(noPronounsSetMessage);
|
||||
else
|
||||
await ctx.Reply($"{(isOwnSystem ? "Your" : "This system's")} current pronouns are **{target.Pronouns}**.\nTo print the pronouns with formatting, type `pk;system pronouns -raw`."
|
||||
+ (isOwnSystem ? " To clear them, type `pk;system pronouns -clear`."
|
||||
: "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue