PROPERLY handle example proxy "text"
This commit is contained in:
@@ -45,7 +45,7 @@ namespace PluralKit.Bot.Commands
|
||||
|
||||
// "Sub"command: no arguments clearing
|
||||
// Also matches the pseudo-subcommand "text" which is equivalent to empty proxy tags on both sides.
|
||||
if (!ctx.HasNext() || ctx.Remainder().Equals("text", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!ctx.HasNext() || ctx.Match("clear", "purge", "clean", "removeall"))
|
||||
{
|
||||
// If we already have multiple tags, this would clear everything, so prompt that
|
||||
if (target.ProxyTags.Count > 1)
|
||||
@@ -67,6 +67,7 @@ namespace PluralKit.Bot.Commands
|
||||
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass an example proxy to add (eg. `[text]` or `J:text`).");
|
||||
|
||||
var tagToAdd = ParseProxyTags(ctx.RemainderOrNull());
|
||||
if (tagToAdd.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
if (target.ProxyTags.Contains(tagToAdd))
|
||||
throw Errors.ProxyTagAlreadyExists(tagToAdd, target);
|
||||
|
||||
@@ -86,6 +87,7 @@ namespace PluralKit.Bot.Commands
|
||||
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass a proxy tag to remove (eg. `[text]` or `J:text`).");
|
||||
|
||||
var tagToRemove = ParseProxyTags(ctx.RemainderOrNull());
|
||||
if (tagToRemove.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
if (!target.ProxyTags.Contains(tagToRemove))
|
||||
throw Errors.ProxyTagDoesNotExist(tagToRemove, target);
|
||||
|
||||
@@ -102,7 +104,8 @@ namespace PluralKit.Bot.Commands
|
||||
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass an example proxy to set (eg. `[text]` or `J:text`).");
|
||||
|
||||
var requestedTag = ParseProxyTags(ctx.RemainderOrNull());
|
||||
|
||||
if (requestedTag.IsEmpty) throw Errors.EmptyProxyTags(target);
|
||||
|
||||
// This is mostly a legacy command, so it's gonna error out if there's
|
||||
// already more than one proxy tag.
|
||||
if (target.ProxyTags.Count > 1)
|
||||
|
Reference in New Issue
Block a user