Browse Source

Fix CommandExecuted not invoked on failed parse (#1993)

Co-Authored-By: Adam Gauthier <16079556+louistio@users.noreply.github.com>
tags/3.1.0
Quin Lynch GitHub 3 years ago
parent
commit
82bb3e403f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/Discord.Net.Commands/CommandService.cs

+ 6
- 0
src/Discord.Net.Commands/CommandService.cs View File

@@ -541,6 +541,12 @@ namespace Discord.Commands

if (matchResult.Pipeline is ParseResult parseResult)
{
if (!parseResult.IsSuccess)
{
await _commandExecutedEvent.InvokeAsync(matchResult.Match.Value.Command, context, parseResult);
return parseResult;
}

var executeResult = await matchResult.Match.Value.ExecuteAsync(context, parseResult, services);

if (!executeResult.IsSuccess && !(executeResult is RuntimeResult || executeResult is ExecuteResult)) // succesful results raise the event in CommandInfo#ExecuteInternalAsync (have to raise it there b/c deffered execution)


Loading…
Cancel
Save