Skip to content

Commit

Permalink
refactor: consolidate command deployment and remove context menu depl…
Browse files Browse the repository at this point in the history
…oyment

Signed-off-by: wiibleyde <nathan@bonnell.fr>
  • Loading branch information
Wiibleyde committed Dec 17, 2024
1 parent 984c988 commit aea0d8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
21 changes: 2 additions & 19 deletions src/deploy-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const rest = new REST().setToken(config.DISCORD_TOKEN)
*/
export async function deployCommands(): Promise<void> {
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],
}
)

Expand All @@ -41,23 +41,6 @@ export async function deployCommands(): Promise<void> {
}
}

export async function deployContextMenus(): Promise<void> {
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.
*
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -51,7 +51,6 @@ client.once(Events.ClientReady, async () => {
})

await deployCommands()
await deployContextMenus()
const devGuild = config.EVE_HOME_GUILD
await deployDevCommands(devGuild)

Expand Down

0 comments on commit aea0d8c

Please sign in to comment.