Running commands manually

Is there a way to run commands manually, without a message/interaction making Sapphire do it?
Solution:
Example ``ts // or, if in a command class, just use this.store` const commands = container.stores.get('commands');...
Jump to solution
7 Replies
Favna
Favna•16mo ago
Get it from the store and call the appropriate run command with the appropriate arguments
Solution
Lioness100
Lioness100•16mo ago
Example
// or, if in a command class, just use `this.store`
const commands = container.stores.get('commands');
const command = commands.get('commandName');

await command.interactionRun(/* insert interaction */);
// or, if in a command class, just use `this.store`
const commands = container.stores.get('commands');
const command = commands.get('commandName');

await command.interactionRun(/* insert interaction */);
oriel beck
oriel beck•16mo ago
I hoped there is a better way
b1nzee
b1nzee•16mo ago
What better way was you hoping for? I mean, you can always extend sapphire / DJS classes for your own preferred methods 🤷
oriel beck
oriel beck•16mo ago
Being able to access the way sapphire runs them (going through preconditions etc)
Favna
Favna•16mo ago
i mean you ccan do that too, you just need to look at the sapphire code and copy it https://github.com/sapphiredev/framework/blob/main/src/listeners/application-commands/chat-input/CorePreChatInputCommandRun.ts
oriel beck
oriel beck•16mo ago
Oooh that's what I was looking for, thank you I need the messageRun, but it's probably the exact same thing
Want results from more Discord servers?
Add your server