Sunar

Protector

Protectors in Sunar act as middleware, allowing you to intercept and control the flow of commands and interactions within your Discord bot. They provide a flexible way to enforce permissions, validate inputs, or perform pre-processing before executing commands.

Usage

import { Protector, execute } from 'sunar';
 
const protector = new Protector({
	commands: ['slash'],
});
 
execute(protector, (arg) => {
	// handle execution
});
 
export { protector };

Implementation

In the middlewares guide you can find a detailed example of the implementation of protectors.

Last updated on

On this page

GitHubEdit on Github ↗