Skip to content

fix(IsLoadableModule): return false for abstract classes #3148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

OverwrittenCode
Copy link
Contributor

@OverwrittenCode OverwrittenCode commented Jun 23, 2025

Description

IsLoadableModule did not check the property TypeInfo.IsAbstract. Therefore, an unnecessary warning log stated that it could not be loaded.

Now, if a class is abstract, it will be ignored safely and all the inheritors will continue to load any commands.

Changes

  • fix(IsLoadableModule): return false for abstract classes
  • fix: handle other attributes
  • refactor: simplify attribute logic
  • fix: correct terminology in debug message

Related Issues

N/A

IsLoadableModule did not check the property TypeInfo.IsAbstract.
Therefore, an unnecessary warning log stated that it could not be loaded.

Now, if a class is abstract, it will be ignored safely and all the inheritors will continue to load any commands.
@OverwrittenCode
Copy link
Contributor Author

OverwrittenCode commented Jun 27, 2025

@Cenngo your suggestion looks completely fine - I have:

  • Accepted your suggestion and slightly modified it so the switch statement is no longer needed.
  • Corrected the debug message

Do you think we can mark this PR as Ready for review?

Hold on, we might be missing some.

Screenshot of the src/Discord.Net.Interactions/Attributes/Commands folder for reference:

src/Discord.Net.Interactions/Attributes/Commands

  • AutocompleteCommandAttribute
  • ComponentInteractionAttribute
  • ContextCommandAttribute
  • MessageCommandAttribute
  • ModalInteractionAttribute
  • SlashCommandAttribute
  • UserCommandAttribute

Should I include MessageCommandAttribute and UserCommandAttribute before marking this PR ready for review?

Also, it may help to sort the is pattern matching alphabetically so it is easier to compare to the source folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants