Re-added medusa system, but untested

This commit is contained in:
Kwoth
2024-05-04 08:08:13 +00:00
parent ea0b51d474
commit 6a7ab79446
8 changed files with 152 additions and 373 deletions

View File

@@ -132,7 +132,6 @@ public sealed class Bot : IBot
foreach (var a in _loadedAssemblies)
{
svcs.AddConfigServices(a)
.AddConfigMigrators(a)
.AddLifetimeServices(a);
}
@@ -157,9 +156,6 @@ public sealed class Bot : IBot
Services = svcs;
Services.GetRequiredService<IBehaviorHandler>().Initialize();
if (Client.ShardId == 0)
ApplyConfigMigrations();
foreach (var a in _loadedAssemblies)
{
LoadTypeReaders(a);
@@ -169,14 +165,6 @@ public sealed class Bot : IBot
Log.Information("All services loaded in {ServiceLoadTime:F2}s", sw.Elapsed.TotalSeconds);
}
private void ApplyConfigMigrations()
{
// execute all migrators
var migrators = Services.GetServices<IConfigMigrator>();
foreach (var migrator in migrators)
migrator.EnsureMigrated();
}
private void LoadTypeReaders(Assembly assembly)
{
var filteredTypes = assembly.GetExportedTypes()