Resolver
Reading time:1 min read
The CommandResolver is responsible for locating commands given an interaction or customId context.
When to override
| ✅ Override if you want to... | ❌ Don't override if you want to... |
|---|---|
| Customize how commands are located from the repository when an interaction is received. | Introduce other localization methods. It's easier to make your own method that uses the CommandRepository. |
| You need to perform extra logic while locating a command. | Deserialize customIds in different ways. That would be the CommandCustomIdCodec's job. |
Overriding
Creation
Create a custom command resolver by either:
- Extending
DefaultCommandResolver(recommended, less work). - Implementing
CommandResolver.
import { } from '@nyx-discord/djs';
class extends {}Registration
Create it and set it to the CommandManager.
class extends {
/** Your overrides */
}
.().(.());The DefaultCommandResolver.create() method instantiates your custom resolver, not the default one.
Edit on GitHub
Last updated on
