public CommandContext(Command interpretedcommand, CommandSearchResult commandSearch, string argSection, IndexArray <string> args) { InterpretedCommand = interpretedcommand; CommandSearch = commandSearch; ArgumentSection = argSection; Arguments = args; }
public override ICommandContext ParseCommand(IMessageContext dmContext) { string message = dmContext.Content.Substring(Prefix.Length); string commandIdentifier; string argSection; getCommandIdentifierAndArgSection(message, out commandIdentifier, out argSection); if (argSection.Length == 0) { CommandSearchResult searchResult = CommandCollection.TryFindCommand(commandIdentifier, 0, out Command command); return(new CommandContext(command, searchResult, argSection, new IndexArray <string>(0))); } else { var args = getArguments(argSection); CommandSearchResult searchResult = CommandCollection.TryFindCommand(commandIdentifier, args.Count, out Command command); return(new CommandContext(command, searchResult, argSection, args)); } }