Search
Star
Feedback
Setup for Free
ยฉ 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
How to get subcommand name from interaction object? - Sapphire - Imagine a Framework
S-IaF
Sapphire - Imagine a Framework
โข
3y ago
โข
7 replies
MRDGH2821
How to get subcommand name from interaction object?
I
am
will be having multiple commands which have their own sub commands
(3 sub command per parent command
)
.
Out of those 3 sub commands
, 2 of them will have AutoComplete
.
How do I distinguish between sub commands
?
interaction.commandName
interaction.commandName
gives only the parent command name
, not sub command name
Solution
After some research I found out that this can be done using
:
interaction.options.
getSubcommand
()
interaction.options.
getSubcommand
()
This gives the sub command name by which you can do respective operations
Jump to solution
Sapphire - Imagine a Framework
Join
Sapphire is a next-gen object-oriented Discord.js bot framework.
2,261
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
subcommand name
S-IaF
Sapphire - Imagine a Framework / sapphire-support
3y ago
How to get SubCommand Ids
S-IaF
Sapphire - Imagine a Framework / sapphire-support
4y ago
AutoComplete subcommand name/id
S-IaF
Sapphire - Imagine a Framework / sapphire-support
3y ago
Retrieve which subcommand was ran from message and interaction
S-IaF
Sapphire - Imagine a Framework / sapphire-support
3y ago