Browse Source

Fixed command parameter check

tags/1.0-rc
RogueException 8 years ago
parent
commit
fc62cd52d1
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/Discord.Net.Commands/Command.cs

+ 2
- 2
src/Discord.Net.Commands/Command.cs 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++)


Loading…
Cancel
Save