Added CommandService.Unload(Module) overload

This commit is contained in:
RogueException
2016-06-26 21:00:39 -03:00
parent f6595aa73e
commit 5ac320312d
2 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);