From 160552f7a3f2825b1f81d5d8463de20461db54d4 Mon Sep 17 00:00:00 2001 From: JustNrik <35231903+JustNrik@users.noreply.github.com> Date: Wed, 22 Aug 2018 13:22:12 -0400 Subject: [PATCH] Update CommandService.cs --- src/Discord.Net.Commands/CommandService.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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;