Set global commands guildIds

Hello, is it possible to set globally the guilds id of all commands, For example when developing, I want commands to be only in one server. thank you in advance
3 Replies
Favna
Favna•2y ago
it's not possible but very easily achieved manually. Simply do: in your command files:
import { guildIds } from '../../lib/constants';
// ...
public override registerApplicationCommands(registry: ChatInputCommand.Registry) {
registry.registerChatInputCommand(
(builder) =>
builder //
.setName(this.name)
.setDescription(this.description),
{ guildIds: guildIds }
);
}
import { guildIds } from '../../lib/constants';
// ...
public override registerApplicationCommands(registry: ChatInputCommand.Registry) {
registry.registerChatInputCommand(
(builder) =>
builder //
.setName(this.name)
.setDescription(this.description),
{ guildIds: guildIds }
);
}
in another file, for example src/lib/constants.ts
export guildIds: string[] = ['first-id', 'second-id', 'etc']
export guildIds: string[] = ['first-id', 'second-id', 'etc']
(never forget the JS basics 😉 )
Sumonil
SumonilOP•2y ago
Thank you :)
Favna
Favna•15mo ago
Sapphire Framework
Globally configuring guildIds | Sapphire
Previously at Registering Chat Input Commands - guildIds we covered how to register single commands
Want results from more Discord servers?
Add your server