From 97d427a6a80174e0532b15e6551149dcdb969aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 8 Oct 2023 18:53:21 -0500 Subject: [PATCH] feat: better guild command handling --- src/events/interactionCreate/index.ts | 33 +++++++++------------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/events/interactionCreate/index.ts b/src/events/interactionCreate/index.ts index 823eca426..db65bf71d 100644 --- a/src/events/interactionCreate/index.ts +++ b/src/events/interactionCreate/index.ts @@ -134,30 +134,19 @@ commands.then((awaitedCommands) => { try { console.log(`Refreshing ${publicCommands.length} public command(s).`); - rest - .put(Routes.applicationCommands(getClientId()), { body: publicCommands }) - .then((publicData) => { - console.log( - `Successfully refreshed ${ - (publicData as RESTPostAPIChatInputApplicationCommandsJSONBody[]) - .length - } public command(s).`, - ); - }); + rest.put(Routes.applicationCommands(getClientId()), { + body: publicCommands, + }); console.log(`Refreshing ${guildCommands.length} guild command(s).`); - rest - .put( - Routes.applicationGuildCommands(getClientId(), discord.tres_guild_id), - { body: guildCommands }, - ) - .then((guildData) => { - console.log( - `Successfully refreshed ${ - (guildData as unknown[]).length - } guild command(s).`, - ); - }); + (isDev() + ? [discord.test_guild_id] + : [discord.tres_guild_id, discord.sklld_guild_id] + ).forEach((guildId) => + rest.put(Routes.applicationGuildCommands(getClientId(), guildId), { + body: guildCommands, + }), + ); } catch (error) { console.error(error); }