From aea0d8c405d4a7725cad5bfbb35b706cd7376fa9 Mon Sep 17 00:00:00 2001 From: wiibleyde Date: Tue, 17 Dec 2024 09:58:49 +0100 Subject: [PATCH] refactor: consolidate command deployment and remove context menu deployment Signed-off-by: wiibleyde --- src/deploy-commands.ts | 21 ++------------------- src/index.ts | 3 +-- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/deploy-commands.ts b/src/deploy-commands.ts index aba7795..ce60f75 100644 --- a/src/deploy-commands.ts +++ b/src/deploy-commands.ts @@ -26,12 +26,12 @@ const rest = new REST().setToken(config.DISCORD_TOKEN) */ export async function deployCommands(): Promise { try { - logger.info(`Chargement des commandes globales (${commandsData.length})...`) + logger.info(`Chargement des commandes globales (${commandsData.length + contextCommandsData.length})...`) await rest.put( Routes.applicationCommands(config.DISCORD_CLIENT_ID), { - body: commandsData, + body: [...commandsData, ...contextCommandsData], } ) @@ -41,23 +41,6 @@ export async function deployCommands(): Promise { } } -export async function deployContextMenus(): Promise { - try { - logger.info(`Chargement des menus contextuels (${contextCommandsData.length})...`) - - await rest.put( - Routes.applicationCommands(config.DISCORD_CLIENT_ID), - { - body: contextCommandsData, - } - ) - - logger.info("Menus contextuels chargés avec succès") - } catch (error) { - logger.error(error as string) - } -} - /** * Deploys development commands to a specified guild. * diff --git a/src/index.ts b/src/index.ts index b792b2a..6b5babb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import { ActivityType, Client, EmbedBuilder, Events, GatewayIntentBits, Partials } from "discord.js" -import { deployCommands, deployContextMenus, deployDevCommands } from "@/deploy-commands" +import { deployCommands, deployDevCommands } from "@/deploy-commands" import { config } from "@/config" import { Logger } from "@/utils/logger" import { CronJob } from 'cron' @@ -51,7 +51,6 @@ client.once(Events.ClientReady, async () => { }) await deployCommands() - await deployContextMenus() const devGuild = config.EVE_HOME_GUILD await deployDevCommands(devGuild)