public CommandHandler(string prefix, DiscordSocketClient client) { _client = client; Prefix = prefix; client.OnMessageReceived += Client_OnMessageReceived; _commands = new List <KeyValuePair <DiscordCommand, Type> >(); Commands = new List <DiscordCommand>(); Assembly executable = Assembly.GetEntryAssembly(); foreach (var type in executable.GetTypes()) { try { CommandAttribute attribute = (CommandAttribute)type.GetCustomAttributes().First(a => a.GetType() == typeof(CommandAttribute)); if (!type.GetInterfaces().Contains(typeof(ICommand))) { throw new NotImplementedException("All Anarchy command handlers must inherit ICommand"); } DiscordCommand cmd = new DiscordCommand(attribute.Command, FindArgumentProperties(type), attribute.Description); _commands.Add(new KeyValuePair <DiscordCommand, Type>(cmd, type)); Commands.Add(cmd); } catch { } } }
public MissingParameterEventArgs(DiscordCommand command, ParameterAttribute param) { Command = command; Parameter = param; }