Fix for windows

Slash-V14
Supositware 2 months ago
parent 2afbca10ec
commit c3fd22f02f

@ -2,7 +2,7 @@ import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v9'; import { Routes } from 'discord-api-types/v9';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const { clientId, guildId, token } = process.env; const { clientId, guildId, token } = process.env;
@ -17,7 +17,7 @@ for (let i = 0; i < categoryPath.length; i++) {
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) { for (const file of commandFiles) {
const filePath = path.join(commandsPath, file); const filePath = path.join(commandsPath, file);
const command = await import(filePath); const command = await import(pathToFileURL(filePath));
if (command.default.integration_types) { if (command.default.integration_types) {
Object.assign(command.default.data, { integration_types: command.default.integration_types }); Object.assign(command.default.data, { integration_types: command.default.integration_types });

Loading…
Cancel
Save