Automatically register command settings

Closes #428
This commit is contained in:
Patrik Svensson
2024-02-15 21:18:13 +01:00
committed by Patrik Svensson
parent b6e0b2389a
commit fde9ee04cf
6 changed files with 132 additions and 5 deletions

View File

@ -17,6 +17,12 @@ internal static class TypeRegistrarExtensions
throw new InvalidOperationException("Command setting type cannot be null.");
}
if (command.SettingsType is { IsAbstract: false, IsClass: true })
{
// Register the settings type
registrar?.Register(command.SettingsType, command.SettingsType);
}
if (command.CommandType != null)
{
registrar?.Register(command.CommandType, command.CommandType);