Added CommandService.Unload(Module) overload
This commit is contained in:
@@ -190,6 +190,18 @@ namespace Discord.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> Unload(Module module)
|
||||
{
|
||||
await _moduleLock.WaitAsync().ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
return UnloadInternal(module.Instance);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_moduleLock.Release();
|
||||
}
|
||||
}
|
||||
public async Task<bool> Unload(object module)
|
||||
{
|
||||
await _moduleLock.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
@@ -10,11 +10,13 @@ namespace Discord.Commands
|
||||
public CommandService Service { get; }
|
||||
public string Name { get; }
|
||||
public IEnumerable<Command> Commands { get; }
|
||||
internal object Instance { get; }
|
||||
|
||||
internal Module(CommandService service, object instance, TypeInfo typeInfo)
|
||||
{
|
||||
Service = service;
|
||||
Name = typeInfo.Name;
|
||||
Instance = instance;
|
||||
|
||||
List<Command> commands = new List<Command>();
|
||||
SearchClass(instance, commands, typeInfo);
|
||||
|
||||
Reference in New Issue
Block a user