Browse Source

fix: Fixed CommandExecuted firing twice for failed RuntimeResults (#1192)

* Fixed CommandExecuted firing twice for failed RuntimeResults

* Changed to just checking the result type

* Amendments
tags/2.0
Casino Boyale Christopher F 6 years ago
parent
commit
10233f3a9a
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Commands/CommandService.cs

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

@@ -603,7 +603,7 @@ namespace Discord.Commands
//If we get this far, at least one parse was successful. Execute the most likely overload.
var chosenOverload = successfulParses[0];
var result = await chosenOverload.Key.ExecuteAsync(context, chosenOverload.Value, services).ConfigureAwait(false);
if (!result.IsSuccess) // succesful results raise the event in CommandInfo#ExecuteInternalAsync (have to raise it there b/c deffered execution)
if (!result.IsSuccess && !(result is RuntimeResult)) // succesful results raise the event in CommandInfo#ExecuteInternalAsync (have to raise it there b/c deffered execution)
await _commandExecutedEvent.InvokeAsync(chosenOverload.Key.Command, context, result);
return result;
}


Loading…
Cancel
Save