mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
feat(bot): allow 'pk;logclean' in DMs
This commit is contained in:
parent
cfd9dff6c5
commit
b04b6e38d2
2 changed files with 25 additions and 20 deletions
|
|
@ -103,6 +103,13 @@ public static class ContextArgumentsExt
|
|||
ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw");
|
||||
|
||||
public static bool MatchToggle(this Context ctx, bool? defaultValue = null)
|
||||
{
|
||||
var value = ctx.MatchToggleOrNull(defaultValue);
|
||||
if (value == null) throw new PKError("You must pass either \"on\" or \"off\" to this command.");
|
||||
return value.Value;
|
||||
}
|
||||
|
||||
public static bool? MatchToggleOrNull(this Context ctx, bool? defaultValue = null)
|
||||
{
|
||||
if (defaultValue != null && ctx.MatchClearInner())
|
||||
return defaultValue.Value;
|
||||
|
|
@ -114,8 +121,7 @@ public static class ContextArgumentsExt
|
|||
return true;
|
||||
else if (ctx.Match(noToggles) || ctx.MatchFlag(noToggles))
|
||||
return false;
|
||||
else
|
||||
throw new PKError("You must pass either \"on\" or \"off\" to this command.");
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static (ulong? messageId, ulong? channelId) MatchMessage(this Context ctx, bool parseRawMessageId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue