Sunar

Global Registration

Global registration allows commands to be registered universally across all servers where the bot is present, simplifying deployment and ensuring consistency in command availability across Discord communities.

src/signals/ready.js
import { Signal, execute } from 'sunar';
import { registerGlobalCommands } from 'sunar/registry';
 
const signal = new Signal('ready', { once: true });
 
execute(signal, async (client) => {
	await registerGlobalCommands(client.application);
 
	console.log(`${client.user.tag} logged!`);
});
 
export { signal };

Using this method is ideal for production environments as it ensures your commands are accessible across all servers your bot is in.

Last updated on

On this page

No Headings
GitHubEdit on Github ↗