| @@ -483,25 +483,27 @@ namespace Discord.Commands | |||||
| /// <param name="context">The context of the command.</param> | /// <param name="context">The context of the command.</param> | ||||
| /// <param name="argPos">The position of which the command starts at.</param> | /// <param name="argPos">The position of which the command starts at.</param> | ||||
| /// <param name="services">The service to be used in the command's dependency injection.</param> | /// <param name="services">The service to be used in the command's dependency injection.</param> | ||||
| /// <param name="enterTyping">Whether the client should enter typing state.</param> | |||||
| /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | ||||
| /// <returns> | /// <returns> | ||||
| /// A task that represents the asynchronous execution operation. The task result contains the result of the | /// A task that represents the asynchronous execution operation. The task result contains the result of the | ||||
| /// command execution. | /// command execution. | ||||
| /// </returns> | /// </returns> | ||||
| public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | |||||
| => ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling); | |||||
| public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, bool enterTyping = false, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | |||||
| => ExecuteAsync(context, context.Message.Content.Substring(argPos), services, enterTyping, multiMatchHandling); | |||||
| /// <summary> | /// <summary> | ||||
| /// Executes the command. | /// Executes the command. | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="context">The context of the command.</param> | /// <param name="context">The context of the command.</param> | ||||
| /// <param name="input">The command string.</param> | /// <param name="input">The command string.</param> | ||||
| /// <param name="services">The service to be used in the command's dependency injection.</param> | /// <param name="services">The service to be used in the command's dependency injection.</param> | ||||
| /// <param name="enterTyping">Whether the client should enter typing state.</param> | |||||
| /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | ||||
| /// <returns> | /// <returns> | ||||
| /// A task that represents the asynchronous execution operation. The task result contains the result of the | /// A task that represents the asynchronous execution operation. The task result contains the result of the | ||||
| /// command execution. | /// command execution. | ||||
| /// </returns> | /// </returns> | ||||
| public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | |||||
| public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, bool enterTyping = false, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | |||||
| { | { | ||||
| services = services ?? EmptyServiceProvider.Instance; | services = services ?? EmptyServiceProvider.Instance; | ||||
| @@ -511,7 +513,11 @@ namespace Discord.Commands | |||||
| await _commandExecutedEvent.InvokeAsync(Optional.Create<CommandInfo>(), context, searchResult).ConfigureAwait(false); | await _commandExecutedEvent.InvokeAsync(Optional.Create<CommandInfo>(), context, searchResult).ConfigureAwait(false); | ||||
| return searchResult; | return searchResult; | ||||
| } | } | ||||
| if (enterTyping) | |||||
| { | |||||
| using var typing = context.Channel.EnterTypingState(); | |||||
| } | |||||
| var commands = searchResult.Commands; | var commands = searchResult.Commands; | ||||
| var preconditionResults = new Dictionary<CommandMatch, PreconditionResult>(); | var preconditionResults = new Dictionary<CommandMatch, PreconditionResult>(); | ||||