Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
use node:fs/promises
Browse files Browse the repository at this point in the history
  • Loading branch information
aloop committed Jan 6, 2024
1 parent 1bbee32 commit e01b611
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions deploy-commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "node:fs";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { REST, Routes } from "discord.js";
Expand All @@ -16,13 +16,13 @@ const commandFoldersPath = path.join(
"commands"
);

const commandFolders = fs.readdirSync(commandFoldersPath);
const commandFolders = await fs.readdir(commandFoldersPath);

for (const folder of commandFolders) {
const commandsPath = path.join(commandFoldersPath, folder);
const commandFiles = fs
.readdirSync(commandsPath)
.filter((file) => file.endsWith(".js"));
const commandFiles = (await fs.readdir(commandsPath)).filter((file) =>
file.endsWith(".js")
);

for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "node:fs";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";

Expand All @@ -25,13 +25,13 @@ const commandFoldersPath = path.join(
"commands"
);

const commandFolders = fs.readdirSync(commandFoldersPath);
const commandFolders = await fs.readdir(commandFoldersPath);

for (const folder of commandFolders) {
const commandsPath = path.join(commandFoldersPath, folder);
const commandFiles = fs
.readdirSync(commandsPath)
.filter((file) => file.endsWith(".js"));
const commandFiles = (await fs.readdir(commandsPath)).filter((file) =>
file.endsWith(".js")
);

for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
Expand Down Expand Up @@ -113,9 +113,9 @@ const cronTasksPath = path.join(
"cron-tasks"
);

const cronTasks = fs
.readdirSync(cronTasksPath)
.filter((file) => file.endsWith(".js"));
const cronTasks = (await fs.readdir(cronTasksPath)).filter((file) =>
file.endsWith(".js")
);

for (const file of cronTasks) {
const filePath = path.join(cronTasksPath, file);
Expand Down

0 comments on commit e01b611

Please sign in to comment.