From 09a180e36e8e7c7c0ba475bada895f9e6e5d841c Mon Sep 17 00:00:00 2001 From: Supositware Date: Thu, 4 Jul 2024 05:53:39 +0200 Subject: [PATCH] Fix for windows --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5614744..82afd20 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; -import { fileURLToPath } from 'node:url'; +import { fileURLToPath, pathToFileURL } from 'node:url'; import { Client, Collection, GatewayIntentBits, Partials } from 'discord.js'; import dotenv from 'dotenv'; dotenv.config(); @@ -41,7 +41,7 @@ async function loadCommandFromDir(dir) { for (const file of commandFiles) { const filePath = path.join(commandsPath, file); - import(filePath) + import(pathToFileURL(filePath)) .then(importedCommand => { const command = importedCommand.default; client.commands.set(command.data.name, command); @@ -57,7 +57,7 @@ async function loadEventFromDir(dir, listener) { for (const file of eventFiles) { const filePath = path.join(eventsPath, file); - import(filePath) + import(pathToFileURL(filePath)) .then(importedEvent => { const event = importedEvent.default; if (event.once) {