Added func-based UsingXXX extensions

This commit is contained in:
RogueException
2016-01-09 19:41:53 -04:00
parent 23ff457d37
commit 3ddd8b509b
3 changed files with 22 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
namespace Discord.Commands
using System;
namespace Discord.Commands
{
public static class CommandExtensions
{
@@ -7,6 +9,13 @@
client.Services.Add(new CommandService(config));
return client;
}
public static DiscordClient UsingCommands(this DiscordClient client, Action<CommandServiceConfig> configFunc = null)
{
var config = new CommandServiceConfig();
configFunc(config);
client.Services.Add(new CommandService(config));
return client;
}
public static CommandService Commands(this DiscordClient client, bool required = true)
=> client.Services.Get<CommandService>(required);
}