Browse Source

Update CommandService.cs

pull/1130/head
JustNrik GitHub 7 years ago
parent
commit
160552f7a3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      src/Discord.Net.Commands/CommandService.cs

+ 15
- 0
src/Discord.Net.Commands/CommandService.cs View File

@@ -348,6 +348,21 @@ namespace Discord.Commands


public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception)
=> ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling); => ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling);
public Task<IResult> ExecuteAsync(ICommandContext context, char suffix, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception)
=> ExecuteAsync(context, context.Message.Content.Trim(suffix), services, multiMatchHandling);
public Task<IResult> 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<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception)
{ {
services = services ?? EmptyServiceProvider.Instance; services = services ?? EmptyServiceProvider.Instance;


Loading…
Cancel
Save