@@ -5,6 +5,7 @@ import type {
55 SlashCommandSubcommandsOnlyBuilder
66} from '@discordjs/builders' ;
77import { container } from '@sapphire/pieces' ;
8+ import { isNullishOrEmpty } from '@sapphire/utilities' ;
89import {
910 ApplicationCommandType ,
1011 RESTPostAPIChatInputApplicationCommandsJSONBody ,
@@ -20,7 +21,7 @@ import type {
2021 UserApplicationCommandData
2122} from 'discord.js' ;
2223import { InternalRegistryAPIType , RegisterBehavior } from '../../types/Enums' ;
23- import { getDefaultBehaviorWhenNotIdentical } from './ApplicationCommandRegistries' ;
24+ import { allGuildIdsToFetchCommandsFor , getDefaultBehaviorWhenNotIdentical } from './ApplicationCommandRegistries' ;
2425import { CommandDifference , getCommandDifferences , getCommandDifferencesFast } from './computeDifferences' ;
2526import { convertApplicationCommandToApiData , normalizeChatInputCommand , normalizeContextMenuCommand } from './normalizeInputs' ;
2627
@@ -29,6 +30,7 @@ export class ApplicationCommandRegistry {
2930
3031 public readonly chatInputCommands = new Set < string > ( ) ;
3132 public readonly contextMenuCommands = new Set < string > ( ) ;
33+ public readonly guildIdsToFetch = new Set < string > ( ) ;
3234
3335 private readonly apiCalls : InternalAPICall [ ] = [ ] ;
3436
@@ -66,6 +68,13 @@ export class ApplicationCommandRegistry {
6668 }
6769 }
6870
71+ if ( ! isNullishOrEmpty ( options ?. guildIds ) ) {
72+ for ( const id of options ! . guildIds ) {
73+ this . guildIdsToFetch . add ( id ) ;
74+ allGuildIdsToFetchCommandsFor . add ( id ) ;
75+ }
76+ }
77+
6978 return this ;
7079 }
7180
@@ -93,6 +102,13 @@ export class ApplicationCommandRegistry {
93102 }
94103 }
95104
105+ if ( ! isNullishOrEmpty ( options ?. guildIds ) ) {
106+ for ( const id of options ! . guildIds ) {
107+ this . guildIdsToFetch . add ( id ) ;
108+ allGuildIdsToFetchCommandsFor . add ( id ) ;
109+ }
110+ }
111+
96112 return this ;
97113 }
98114
0 commit comments