From c80ecc4212929e34ab55d56ed80fef1aa9e3dd19 Mon Sep 17 00:00:00 2001 From: Ghellab Abderrahmane <43763935+rhaym-tech@users.noreply.github.com> Date: Sat, 13 Jan 2024 00:41:41 +0900 Subject: [PATCH] remove old files from cache --- src/structures/BotClient.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/structures/BotClient.js b/src/structures/BotClient.js index 5cec62ebf..907febc0b 100644 --- a/src/structures/BotClient.js +++ b/src/structures/BotClient.js @@ -175,6 +175,7 @@ module.exports = class BotClient extends Client { const files = recursiveReadDirSync(directory); for (const file of files) { try { + delete require.cache[require.resolve(file)]; const cmd = require(file); if (typeof cmd !== "object") continue; validateCommand(cmd); @@ -198,6 +199,7 @@ module.exports = class BotClient extends Client { const files = recursiveReadDirSync(directory); for (const file of files) { try { + delete require.cache[require.resolve(file)]; const ctx = require(file); if (typeof ctx !== "object") continue; validateContext(ctx);