Creates a new event middleware
The predicate of the middleware
Optional
failCallback: EventCallbackThe callback to call if the predicate fails
// This means that the event will only be triggered if the client is ready
const IsClientReady = new EventMiddleware(
(client) => client.isReady(),
(client) => console.log('Event not called since client is not ready')
);
module.exports.default = new Event({
// ...
middlewares: [IsClientReady]
}, (...) => { ... });
Optional
failThe callback to call if the predicate fails
The predicate of the middleware
Generated using TypeDoc
Represents an event middleware