Add syntax error if pk;m proxy is missing arguments

This commit is contained in:
Ske 2019-11-02 02:57:55 +01:00
parent 6c39b7549b
commit 6aa72f68b3

View File

@ -184,6 +184,8 @@ namespace PluralKit.Bot.Commands
// Subcommand: "add" // Subcommand: "add"
else if (ctx.Match("add")) else if (ctx.Match("add"))
{ {
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass an example proxy to add (eg. `[text]` or `J:text`).");
var tagToAdd = ParseProxyTags(ctx.RemainderOrNull()); var tagToAdd = ParseProxyTags(ctx.RemainderOrNull());
if (target.ProxyTags.Contains(tagToAdd)) if (target.ProxyTags.Contains(tagToAdd))
throw Errors.ProxyTagAlreadyExists(tagToAdd, target); throw Errors.ProxyTagAlreadyExists(tagToAdd, target);
@ -198,6 +200,8 @@ namespace PluralKit.Bot.Commands
// Subcommand: "remove" // Subcommand: "remove"
else if (ctx.Match("remove")) else if (ctx.Match("remove"))
{ {
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass a proxy tag to remove (eg. `[text]` or `J:text`).");
var tagToRemove = ParseProxyTags(ctx.RemainderOrNull()); var tagToRemove = ParseProxyTags(ctx.RemainderOrNull());
if (!target.ProxyTags.Contains(tagToRemove)) if (!target.ProxyTags.Contains(tagToRemove))
throw Errors.ProxyTagDoesNotExist(tagToRemove, target); throw Errors.ProxyTagDoesNotExist(tagToRemove, target);
@ -212,6 +216,8 @@ namespace PluralKit.Bot.Commands
// Subcommand: bare proxy tag given // Subcommand: bare proxy tag given
else else
{ {
if (!ctx.HasNext()) throw new PKSyntaxError("You must pass an example proxy to set (eg. `[text]` or `J:text`).");
var requestedTag = ParseProxyTags(ctx.RemainderOrNull()); var requestedTag = ParseProxyTags(ctx.RemainderOrNull());
// This is mostly a legacy command, so it's gonna error out if there's // This is mostly a legacy command, so it's gonna error out if there's