[Bug]: ModuleInfo.Attributes doesn't contain all attributes the module has
BlyZeDev opened this issue · 1 comments
BlyZeDev commented
Check The Docs
- I double checked the docs and couldn't find any useful information.
Verify Issue Source
- I verified the issue was caused by Discord.Net.
Check your intents
- I double checked that I have the required intents.
Description
The modules of the InteractionService don't contain all attributes.
Version
3.15.3
Working Version
No response
Logs
I don't get an exception or anything like that.
Sample
That's my method
var modules = _service.Modules.Where(x => !x.IsSubModule).ToLookup(x => x.Attributes.Any(x => x is RequireOwnerAttribute));
That's my module
[RequireOwner]
[RequireContext(ContextType.Guild)]
[RequireBotPermission(GuildPermission.ViewChannel | GuildPermission.ReadMessageHistory | GuildPermission.SendMessages)]
public sealed class OwnerModule : MobyModuleBase
That's my MobyModuleBase just so you know it's implemented correctly
public abstract class MobyModuleBase : InteractionModuleBase<SocketInteractionContext>
{
protected readonly DiscordSocketClient _client;
protected readonly IConfiguration _config;
protected readonly IMobyLogger _logger;
protected MobyModuleBase(DiscordSocketClient client, IConfiguration config, IMobyLogger logger)
{
_client = client;
_config = config;
_logger = logger;
}
Packages
These are just all packages in my project
<PackageReference Include="AsyncAwaitBestPractices" Version="8.0.0" />
<PackageReference Include="Discord.Net" Version="3.15.3" />
<PackageReference Include="Lavalink4NET.Artwork" Version="4.0.20" />
<PackageReference Include="Lavalink4NET.Discord.NET" Version="4.0.20" />
<PackageReference Include="Lavalink4NET.InactivityTracking" Version="4.0.20" />
<PackageReference Include="Lavalink4NET.Integrations.Lavasrc" Version="4.0.20" />
<PackageReference Include="Lavalink4NET.Integrations.SponsorBlock" Version="4.0.20" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
Environment
Windows 11 x64
.NET 8
BlyZeYT commented
Fixed by using Preconditions instead of Attributes 🧠😅