Sunar

Guild Specific Registration

Guilds registration involves registering all commands specifically for a list of servers passed directly through a function call, ensuring commands are tailored and accessible only to designated servers.

src/signals/ready.js
import { Signal, execute } from 'sunar';
import { registerGuildCommands } from 'sunar/registry';
 
const signal = new Signal('ready', { once: true });
 
execute(signal, async (client) => {
	await registerGuildCommands(client.application, ['YOUR_GUILD_ID']);
 
	console.log(`${client.user.tag} logged!`);
});
 
export { signal };
Replace 'YOUR_GUILD_ID' with your actual guild IDs.

It is recommended to use this method only in development environments as it allows you to test commands without affecting all servers your bot is in.

Last updated on

On this page

No Headings
GitHubEdit on Github ↗