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(); }