From b28fd87e268f480e76b0d65dad7e56d4dd313f40 Mon Sep 17 00:00:00 2001 From: Joe4evr Date: Tue, 21 Feb 2017 16:50:49 +0100 Subject: [PATCH] Add comment explaining behavior --- src/Discord.Net.Commands/CommandService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index 300000b16..dd47e456d 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -228,6 +228,8 @@ namespace Discord.Commands public SearchResult Search(ICommandContext context, string input) { string searchInput = _caseSensitive ? input : input.ToLowerInvariant(); + + // We sort by Ascending priority here because the collection is looped over backwards later. var matches = _map.GetCommands(searchInput).OrderBy(x => x.Command.Priority).ToImmutableArray(); if (matches.Length > 0)