diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index 6fd5d38ad..64b6f8b1e 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -348,6 +348,21 @@ namespace Discord.Commands public Task ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) => ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling); + public Task ExecuteAsync(ICommandContext context, char suffix, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) + => ExecuteAsync(context, context.Message.Content.Trim(suffix), services, multiMatchHandling); + + public Task ExecuteAsync(ICommandContext context, string suffix, IServiceProvider services, SuffixType type, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) + { + var text = context.Message.Content; + switch (type) + { + case SuffixType.String: + return ExecuteAsync(context, text.Remove(text.IndexOf(suffix) - 1), services, multiMatchHandling); + case SuffixType.Mention: + return ExecuteAsync(context, text.Remove(text.IndexOf(context.Client.CurrentUser.Mention) - 1), services, multiMatchHandling); + } + return ExecuteAsync(context, text, services, multiMatchHandling); + } public async Task ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) { services = services ?? EmptyServiceProvider.Instance;