Skip to content

Conversation

valzargaming
Copy link
Member

This pull request makes improvements to the way registered slash commands are managed within the Discord class. The main changes involve updating the type annotation for the $application_commands property and initializing it with a proper collection in the constructor.

Improvements to slash command management:

  • Updated the type annotation for the $application_commands property in the Discord class to specify it can be an ExCollectionInterface<RegisteredCommand> or an array of RegisteredCommand objects, providing better clarity and type safety.
  • Initialized the $application_commands property in the Discord class constructor using Collection::for(RegisteredCommand::class, 'name'), ensuring it is always a properly structured collection.

@valzargaming
Copy link
Member Author

Before merging this, I would like to know if there is anyone who is accessing this array in a way that isn't just using ArrayAccess methods, such as passing it into a call to array_filter. This change would be breaking for anyone using that, but easily worked around by calling ->toArray() first. Its usage within the library requires no additional changes as it is only accessed via ArrayAccess.

@valzargaming valzargaming requested a review from a team October 7, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant