public override Task ProcessAsync(CommandProcessorInput input) { if (!_config.PrefixIsSet) { return(NextStep.ProcessAsync(input)); } if (input.Message.StartsWith(_config.CommandPrefix)) { input.PrefixOffset = (uint)_config.CommandPrefix.Length; return(NextStep.ProcessAsync(input)); } return(Task.CompletedTask); }
public override Task ProcessAsync(CommandProcessorInput input) { var commands = _serviceCollection.GetAvailableCommands(); if (commands is null || !commands.Any()) { _logWriter.Log("Service Location did not get any available commands."); return(Task.CompletedTask); } var prompt = input.Message.Substring((int)input.PrefixOffset).Trim(); input.TargetedCommands = commands.Where(c => prompt.StartsWith(c.Prompt)); return(NextStep.ProcessAsync(input)); }