mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 06:47:56 +00:00
feat: better command parsing for pk;config
This commit is contained in:
parent
426d753827
commit
1626e0f548
2 changed files with 48 additions and 48 deletions
|
|
@ -99,6 +99,16 @@ public static class ContextArgumentsExt
|
|||
public static bool MatchRaw(this Context ctx) =>
|
||||
ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw");
|
||||
|
||||
public static bool MatchToggle(this Context ctx)
|
||||
{
|
||||
if (ctx.Match("yes", "on", "enable"))
|
||||
return true;
|
||||
else if (ctx.Match("no", "off", "disable"))
|
||||
return false;
|
||||
else
|
||||
throw new PKError("You must pass either \"on\" or \"off\" to this command.");
|
||||
}
|
||||
|
||||
public static (ulong? messageId, ulong? channelId) MatchMessage(this Context ctx, bool parseRawMessageId)
|
||||
{
|
||||
if (ctx.Message.Type == Message.MessageType.Reply && ctx.Message.MessageReference?.MessageId != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue