|
|
@@ -208,7 +208,14 @@ namespace Discord.Commands |
|
|
|
if (!searchResult.IsSuccess) |
|
|
|
return searchResult; |
|
|
|
|
|
|
|
var commands = searchResult.Commands; |
|
|
|
// TODO: this logic is for users who don't manually search/execute: should we keep it? |
|
|
|
|
|
|
|
IReadOnlyList<Command> commands = searchResult.Commands |
|
|
|
.Where(x => x.CanExecute(message)).ToImmutableArray(); |
|
|
|
|
|
|
|
if (commands.Count == 0 && searchResult.Commands.Count > 0) |
|
|
|
return ParseResult.FromError(CommandError.InvalidPermissions, "Invalid permissions"); |
|
|
|
|
|
|
|
for (int i = commands.Count - 1; i >= 0; i--) |
|
|
|
{ |
|
|
|
var parseResult = await commands[i].Parse(message, searchResult); |
|
|
|