SIA
Sapphire - Imagine a frameworkMRDGH2821
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)?F
Favna•390d 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.tsM
MRDGH2821•387d 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.Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.1KMembers
View on DiscordWant results from more Discord servers?
More PostsUserErrors not being caught by listener - bot is crashingmessageCommandError.mjs
```js
import { Events, Listener } from "@sapphire/framework";
import { send Subcommand isn't runningWhen the subcommand is run in Discord, it times out. I've added a log to the beginning of the methodHow to properly handle UserErrors?I'm using the official sapphire template and want to throw a UserError inside a context menu commandCan I set different requiredUserPermissions for each subcommand?Just wondering if this is possible, and how. ThanksHandling BulkOverwrite Registry ErrorsWhen I encounter this error
```
[ERROR] ApplicationCommandRegistries(BulkOverwrite) Failed to overwrEvents for VoiceHow can I do something like the following but for voice?
```
import { Listener } from '@sapphire/frHow do I use autocompleteRun on subcommands?^ As the title says. I can't seem to figure out how subcommands can have autocompleteRun implementedMessage editing fails even though message can be fetchedWhenever I want to edit an ephemeral message I get the following error:
```js
[ERROR] Encountered erProblem with ephemeral messagesI currently have a command which sends a button, problem is, once the button is pressed, I can't remIs recommend have split autocomplete handlersI want know is recommend have split handler such as characterAutocomplete & itemsAutocomplete.Error serverHow can I solve this error ?
```
Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called mQuick question regarding application descriptionsHow does one link an application command in the description of an app? Looks like a mention syntax, What typescript version to use?Since the most recent announcement in #Announcements recommends that I should not use typescript verHow to get subcommand name from interaction object?I ~~am~~ will be having multiple commands which have their own sub commands (3 sub command per parenHow do I listen for reactions on all messages in a channel?doing discord bot dev after a long time. i wanted to listen for message reactions on every message iMessageCreate Event isn't workingThis is the first listener Im creating I've read the documentation 50 times imo and checked out the