PROPERLY handle example proxy "text"
This commit is contained in:
parent
7bdc3020b0
commit
5334975ab7
@ -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)
|
||||
|
@ -86,6 +86,7 @@ namespace PluralKit.Bot {
|
||||
public static PKError ProxyTagAlreadyExists(ProxyTag tagToAdd, PKMember member) => new PKError($"That member already has the proxy tag `{tagToAdd.ProxyString.SanitizeMentions()}`. The member currently has these tags: {member.ProxyTagsString().SanitizeMentions()}");
|
||||
public static PKError ProxyTagDoesNotExist(ProxyTag tagToRemove, PKMember member) => new PKError($"That member does not have the proxy tag `{tagToRemove.ProxyString.SanitizeMentions()}`. The member currently has these tags: {member.ProxyTagsString().SanitizeMentions()}");
|
||||
public static PKError LegacyAlreadyHasProxyTag(ProxyTag requested, PKMember member) => new PKError($"This member already has more than one proxy tag set: {member.ProxyTagsString().SanitizeMentions()}\nConsider using the `pk;member {member.Hid} proxy add {requested.ProxyString.SanitizeMentions()}` command instead.");
|
||||
public static PKError EmptyProxyTags(PKMember member) => new PKError($"The example proxy `text` is equivalent to having no proxy tags at all, since there are no symbols or brackets on either end. If you'd like to clear your proxy tags, use `pk;member {member.Hid} proxy clear`.");
|
||||
|
||||
public static PKError GenericCancelled() => new PKError("Operation cancelled.");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user