I tried to make my own methods to add modules to IInteractionService, filtering by my custom attribute, but when it comes to AddModuleAsync I see System.InvalidOperationException: Could not build the module Geno.Commands.Other+BotCommands, did you pass an invalid type?
public static async Task AddPublicModules(this InteractionService service, Assembly assembly, IServiceProvider serviceProvider)
{
foreach (var T in assembly.DefinedTypes)
{
if ((!T.IsPublic && !T.IsNestedPublic) || !typeof(IInteractionModuleBase).GetTypeInfo().IsAssignableFrom(T))
continue;
if (T.CustomAttributes.TryGetAttribute<MyAttribute>(out _))
continue;
await service.AddModuleAsync(T, serviceProvider).ConfigureAwait(false);
}
}```