From c63e20ca50dfebd7bc6c453156a095b8aa6b3a37 Mon Sep 17 00:00:00 2001 From: Ske Date: Sun, 12 May 2019 00:22:48 +0200 Subject: [PATCH] bot: fix command dispatch --- PluralKit.Bot/Utils.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Utils.cs b/PluralKit.Bot/Utils.cs index e1229886..161fa8c1 100644 --- a/PluralKit.Bot/Utils.cs +++ b/PluralKit.Bot/Utils.cs @@ -153,8 +153,12 @@ namespace PluralKit.Bot public override async Task CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services) { + // This stops the "delegating command" we define above from being called multiple times + // If we've already added a context object to the context, then we'll return with the same + // error you get when there's an invalid command - it's like it didn't exist + // This makes sure the user gets the proper error, instead of the command trying to parse things weirdly if ((context as PKCommandContext)?.GetContextEntity() == null) return PreconditionResult.FromSuccess(); - return PreconditionResult.FromError("(should not be seen)"); + return PreconditionResult.FromError(command.Module.Service.Search("")); } }