Middleware List
Reading time:1 min read
The CommandMiddlewareList is responsible for holding and executing the middlewares that run before a command is executed.
It's inside the CommandExecutor object, and will be executed by it.
When to override
| ✅ Override if you want to... | ❌ Don't override if you want to... |
|---|---|
| Do something before, while or after checking middlewares. | Add new middlewares. The list already supports add and remove operations. |
| Check middlewares in a different way or order. |
Overriding
Creation
Create a custom middleware list by either:
- Extending
CommandMiddlewareList(recommended, less work). - Implementing
MiddlewareList<CommandMiddlewareResolvable>.
import { } from '@nyx-discord/djs';
class extends {}Registration
Create it and set it to the CommandExecutor, then set the executor on the CommandManager.
import { } from '@nyx-discord/djs';
class extends {}
const = .({
: {
: .(),
},
});
.().();The create() method instantiates your custom middleware list, not the default one.
Edit on GitHub
Last updated on
