I want to update my commands code without restarting bot fully using nodemon or just node .
I wanted to make a command I can send to update all commands in my bot (basically commands collection where they are and their code stored). Here is the code I tried to use:
const { glob } = require('glob')
const { promisify } = require('util')
const globPromise = promisify(glob);
await client.commands.clear()
const commandFiles = await globPromise(`${process.cwd()}/commands/**/*.js`);
commandFiles.map((value) => {
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (file.name) {
const properties = { directory, ...file };
client.commands.set(file.name, properties);
}
})
Result says my code worked but commands are not updating, how can I fix it? Just in case: my djs version is v13.2.0