From fe1c65afa1cf534447e90f3928c71db524cc8049 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Mon, 27 Jul 2026 15:51:41 +0300 Subject: [PATCH] fix: windows path --- src/scripts/deploy-commands.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/scripts/deploy-commands.ts b/src/scripts/deploy-commands.ts index a08e87f..2bd4711 100644 --- a/src/scripts/deploy-commands.ts +++ b/src/scripts/deploy-commands.ts @@ -5,16 +5,13 @@ import { } from 'discord.js'; import { commands } from '@/common/commands/index.js'; import { config } from '@/env.js'; +import { pathToFileURL } from 'node:url'; +console.log('Deploying commands...'); export async function deployCommands() { const commandData = [...commands.values()].map((command) => command.data); const rest = new REST({ version: '10' }).setToken(config.discord.token); - const random = Math.floor(Math.random() * 1000); - if (random < 10) { - console.log(`ds ${random}`); - } - try { const result = (await rest.put( Routes.applicationGuildCommands( @@ -34,6 +31,6 @@ export async function deployCommands() { } // If run directly with `node deploy.ts` -if (import.meta.url === `file://${process.argv[1]}`) { - void deployCommands(); +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + await deployCommands(); }