You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs for Discordrb::Bot#application_command (which is included from Discordrb::EventContainer) state that the name argument shall be a symbol, so I would expect that it is intended to not work with strings.
A dive into the source code confirms that:
The application command is called here.
event is a Discordrb::Events::ApplicationCommandEvent, as can be seen a few lines above that one. The initializer of that class turns any command name received from Discord into a symbol.
This symbolized command name is then used to look up the block in a Hash, but the key is the name String you passed, so the lookup fails.
Assuming that it is a common mistake to not read the docs properly, this is probably not the first nor the last time someone has this issue. An improvement could be to convert the command name argument of #application_command to a symbol and maybe even add String as a valid argument type to its documentation (in addition to Symbol).
Summary
When adding application command handlers with a string instead of a symbol, they do not respond.
No warnings are present in the logger either.
Environment
Ruby version:
Discordrb version:
The text was updated successfully, but these errors were encountered: