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

Implementing protectors

Protectors in Sunar act as middleware, allowing you to intercept and control the flow of commands and interactions within your Discord bot.

Reference

ProtectorOptions

Prop

Type

How is this guide?

Last updated on