dc-Ragnarok / Fenrir

PHP Discord Interface
MIT License
4 stars 2 forks source link

Improved option search with iterative approach #98

Closed Naneynonn closed 3 months ago

Naneynonn commented 3 months ago

This pull request improves the getOption method by allowing it to search for nested options using a dot-separated path, like $option = $command->getOption('foo.bar'). This new approach replaces the previous method and provides better support for nested structures, especially for options of type ApplicationCommandOptionType::SUB_COMMAND. The old method does not support nested structures and will fail if you try to retrieve bar from foo.bar.

Exanlv commented 3 months ago

Thanks for the pr!

Would you mind adding a test case for retrieving a nested option? Could either be added to CommandInteractionTest@testParsesOptions or a new test case in that file :)