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•12mo ago
Get it from the store and call the appropriate run command with the appropriate arguments
Solution
Lioness100
Lioness100•12mo 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•12mo ago
I hoped there is a better way
b1nzee
b1nzee•12mo 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•12mo ago
Being able to access the way sapphire runs them (going through preconditions etc)
Favna
Favna•12mo 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•12mo ago
Oooh that's what I was looking for, thank you I need the messageRun, but it's probably the exact same thing