Fixed command parameter check

This commit is contained in:
RogueException
2016-10-04 10:24:01 -03:00
parent 0a09b0deb5
commit fc62cd52d1

View File

@@ -169,8 +169,8 @@ namespace Discord.Commands
private IReadOnlyList<CommandParameter> BuildParameters(MethodInfo methodInfo)
{
var parameters = methodInfo.GetParameters();
if (parameters.Length == 0 || parameters[0].ParameterType != typeof(IUserMessage))
throw new InvalidOperationException($"The first parameter of a command must be {nameof(IUserMessage)}.");
if (parameters.Length == 0 || parameters[0].ParameterType != typeof(CommandContext))
throw new InvalidOperationException($"The first parameter of a command must be {nameof(CommandContext)}.");
var paramBuilder = ImmutableArray.CreateBuilder<CommandParameter>(parameters.Length - 1);
for (int i = 1; i < parameters.Length; i++)