Add Dependency Map, Update Assembly Crawler
[Untested] Assembly Crawler will now accept constructors matching: new(), new(CommandService), new(IDependencyMap). Add IDependencyMap Add DependencyMap
This commit is contained in:
@@ -164,7 +164,7 @@ namespace Discord.Commands
|
||||
|
||||
return loadedModule;
|
||||
}
|
||||
public async Task<IEnumerable<Module>> LoadAssembly(Assembly assembly)
|
||||
public async Task<IEnumerable<Module>> LoadAssembly(Assembly assembly, IDependencyMap dependencyMap = null)
|
||||
{
|
||||
var modules = ImmutableArray.CreateBuilder<Module>();
|
||||
await _moduleLock.WaitAsync().ConfigureAwait(false);
|
||||
@@ -176,7 +176,7 @@ namespace Discord.Commands
|
||||
var moduleAttr = typeInfo.GetCustomAttribute<ModuleAttribute>();
|
||||
if (moduleAttr != null && moduleAttr.Autoload)
|
||||
{
|
||||
var moduleInstance = ReflectionUtils.CreateObject(typeInfo);
|
||||
var moduleInstance = ReflectionUtils.CreateObject(typeInfo, this, dependencyMap);
|
||||
modules.Add(LoadInternal(moduleInstance, moduleAttr, typeInfo));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user