Added required parameter to GetService
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
{
|
||||
public static class ModuleExtensions
|
||||
{
|
||||
public static ModuleService Modules(this DiscordClient client)
|
||||
=> client.GetService<ModuleService>();
|
||||
public static ModuleService Modules(this DiscordClient client, bool required = true)
|
||||
=> client.GetService<ModuleService>(required);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,7 @@ namespace Discord.Modules
|
||||
|
||||
public void CreateCommands(string prefix, Action<CommandGroupBuilder> config)
|
||||
{
|
||||
var commandService = _client.Commands();
|
||||
if (commandService == null)
|
||||
throw new InvalidOperationException($"{nameof(CommandService)} must be added to DiscordClient before this property is accessed.");
|
||||
var commandService = _client.Commands(true);
|
||||
commandService.CreateGroup(prefix, x =>
|
||||
{
|
||||
x.Category(_name);
|
||||
|
||||
Reference in New Issue
Block a user