Refactored typereaders to use DI instead of getting services manually

This commit is contained in:
Kwoth
2021-07-03 23:16:53 +02:00
parent 3cc34bfdc3
commit 4c0c3c9228
11 changed files with 86 additions and 120 deletions

View File

@@ -198,7 +198,7 @@ namespace NadekoBot
var toReturn = new List<object>();
foreach (var ft in filteredTypes)
{
var x = (TypeReader)Activator.CreateInstance(ft, Client, _commandService);
var x = (TypeReader)ActivatorUtilities.CreateInstance(Services, ft);
var baseType = ft.BaseType;
var typeArgs = baseType.GetGenericArguments();
_commandService.AddTypeReader(typeArgs[0], x);