diff --git a/src/Discord.Net.Commands/Command.cs b/src/Discord.Net.Commands/Command.cs index cef697e92..e8d259408 100644 --- a/src/Discord.Net.Commands/Command.cs +++ b/src/Discord.Net.Commands/Command.cs @@ -35,8 +35,6 @@ namespace Discord.Commands public string Category { get; internal set; } public bool IsHidden { get; internal set; } public string Description { get; internal set; } - //public int? MinArgs { get; private set; } - //public int? MaxArgs { get; private set; } public IEnumerable Aliases => _aliases; private string[] _aliases; @@ -46,7 +44,7 @@ namespace Discord.Commands private IPermissionChecker[] _checks; private Func _runFunc; - private Dictionary _parametersByName; + internal readonly Dictionary _parametersByName; internal Command(string text) { diff --git a/src/Discord.Net.Commands/CommandService.Events.cs b/src/Discord.Net.Commands/CommandService.Events.cs index 5acb3e92b..f70223f14 100644 --- a/src/Discord.Net.Commands/CommandService.Events.cs +++ b/src/Discord.Net.Commands/CommandService.Events.cs @@ -4,9 +4,10 @@ namespace Discord.Commands { public class CommandEventArgs { + private readonly string[] _args; + public Message Message { get; } public Command Command { get; } - public string[] Args { get; } public User User => Message.User; public Channel Channel => Message.Channel; @@ -16,8 +17,12 @@ namespace Discord.Commands { Message = message; Command = command; - Args = args; + _args = args; } + + public string[] Args => _args; + public string GetArg(int index) => _args[index]; + public string GetArg(string name) => _args[Command[name].Id]; } public enum CommandErrorType { Exception, UnknownCommand, BadPermissions, BadArgCount, InvalidInput } diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index dfef9b401..25cd99b1b 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -61,14 +61,8 @@ namespace Discord.Commands await client.SendMessage(replyChannel, "Unable to display help: Unknown command."); } else //Show general help - -/* Unmerged change from project 'Discord.Net.Commands' -Before: - await ShowHelp(e.User, e.Channel, replyChannel); -After: - await this.ShowHelp((User)e.User, e.Channel, replyChannel); -*/ - await this.ShowGeneralHelp(e.User, (Channel)e.Channel, (Channel)replyChannel); + + await ShowGeneralHelp(e.User, e.Channel, replyChannel); })); }