Replaced several arrays with immutables
This commit is contained in:
@@ -213,12 +213,12 @@ namespace Discord.Commands
|
||||
{
|
||||
if (parseResult.Error == CommandError.MultipleMatches)
|
||||
{
|
||||
TypeReaderValue[] argList, paramList;
|
||||
IReadOnlyList<TypeReaderValue> argList, paramList;
|
||||
switch (multiMatchHandling)
|
||||
{
|
||||
case MultiMatchHandling.Best:
|
||||
argList = parseResult.ArgValues.Select(x => x.Values.OrderByDescending(y => y.Score).First()).ToArray();
|
||||
paramList = parseResult.ParamValues.Select(x => x.Values.OrderByDescending(y => y.Score).First()).ToArray();
|
||||
argList = parseResult.ArgValues.Select(x => x.Values.OrderByDescending(y => y.Score).First()).ToImmutableArray();
|
||||
paramList = parseResult.ParamValues.Select(x => x.Values.OrderByDescending(y => y.Score).First()).ToImmutableArray();
|
||||
parseResult = ParseResult.FromSuccess(argList, paramList);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -74,7 +75,7 @@ namespace Discord.Commands
|
||||
}
|
||||
|
||||
if (results.Count > 0)
|
||||
return TypeReaderResult.FromSuccess(results.Values.ToArray());
|
||||
return TypeReaderResult.FromSuccess(results.Values.ToImmutableArray());
|
||||
return TypeReaderResult.FromError(CommandError.ObjectNotFound, "User not found.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user