Context Menu Command and Subcommand cannot be in same extended class?

I have a slash command which is an extended Subcommand called give-role with two subcommands - one & multi. The file name is give-role.ts Now I also want a Context Menu command named Give Role within same give-role.ts I can register both slash command & context menu command, but cannot provide contextMenuRun() within same give-role class. Any solution(s)?
2 Replies
Favna
Favna2y ago
Are you using this.name for setName for the context menu command if so, that's why it's failing You just need to register them with different names i.e. https://github.com/favware/archangel/blob/main/src/commands/Core/start-quote.ts
MRDGH2821
MRDGH2821OP2y ago
I found sapphire to handle it properly when I simply provided contextMenuRun function inside the Subcommand Class. And it works flawlessly! Example: https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/blob/rewrite-sapphire/src/baseBot/commands/give-role.ts#L362 I wasn't getting VSCode's autocomplete suggestions for contextMenuRun inside Subcommand class To summarise: Simply provide the contextMenuRun method inside Subcommand class, it will work. Tried and tested multiple times.
Want results from more Discord servers?
Add your server