Reputation: 37
Can I attach slash command options to a custom command like "?help" and not "/help"?
Upvotes: 0
Views: 1216
Reputation: 81
I’m not entirely sure that I know what you mean, but I’ll try to answer.
?help
is something we call a message command. It’s basically a message and is received as a messageCreate
event. The bot then filters all message events to only respond to those with the specified prefix (in this case “?”). The only thing a user can submit via a message is the message content, a string, and attachments, which are files. You can access that via .content
. You can make the user submit arguments by typing space and then e. g. writing a category name (?help moderation
) which you could then recognise with <Message>.content.split(“ “);
.
/help
is, when registered as such, a slash command (interaction). When received, the interactionCreate
event is called. When you register a slash command, you can add options such as string, integer, member and so on. These are registered beforehand and only in because of that, discord knows what options to give the user. And yeah, after that, you can access these options via the interaction.
To sum up (if I understand you correctly), you can’t attach (slash command) options to message commands because they are handled differently by discord. You can, however, utilise spaces to use these options. (Slash Commands are not using spaces but rely only on these options.)
I hope this helps.
Upvotes: 1