My commands not uploading

I didn't moved anything strange but my commands don't don't update once I restart my bot
19 Replies
d.js toolkit
d.js toolkit•7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - ✅ Marked as resolved by staff
Zer0 🥀
Zer0 🥀•7mo ago
14.13.0 no console error just no updating
treble/luna
treble/luna•7mo ago
#how-to-get-help , please provide more info
Zer0 🥀
Zer0 🥀•7mo ago
idk what I can provide there is no error
treble/luna
treble/luna•7mo ago
and in the first place you should not register commands every time you restart your bot your actual code without code i cant help
Zer0 🥀
Zer0 🥀•7mo ago
async function loadCommands(client) {
const ascii = require("ascii-table");
const fs = require("fs");
var colors = require('colors');
const table = new ascii().setHeading("Comandos", "Estado");

let commandsArray = [];

const commandsFolder = fs.readdirSync("./comandos");
for (const folder of commandsFolder) {
const commandFiles = fs
.readdirSync(`./comandos/${folder}`)
.filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
const commandFile = require(`../comandos/${folder}/${file}`);

const properties = { folder, ...commandFile };
client.commands.set(commandFile.data.name, commandFile);

commandsArray.push(commandFile.data.toJSON());
console.log(`[ KIRI-COMANDOS ]`.underline.cyan + " --- Cargando ".cyan + ` ${commandFile.data.name}`.cyan);
await new Promise(resolve => setTimeout(resolve, 10)); // wait for 2 seconds
table.addRow(file, "cargado");
continue;
}
}

client.application.commands.set(commandsArray);
}

module.exports = { loadCommands };
async function loadCommands(client) {
const ascii = require("ascii-table");
const fs = require("fs");
var colors = require('colors');
const table = new ascii().setHeading("Comandos", "Estado");

let commandsArray = [];

const commandsFolder = fs.readdirSync("./comandos");
for (const folder of commandsFolder) {
const commandFiles = fs
.readdirSync(`./comandos/${folder}`)
.filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
const commandFile = require(`../comandos/${folder}/${file}`);

const properties = { folder, ...commandFile };
client.commands.set(commandFile.data.name, commandFile);

commandsArray.push(commandFile.data.toJSON());
console.log(`[ KIRI-COMANDOS ]`.underline.cyan + " --- Cargando ".cyan + ` ${commandFile.data.name}`.cyan);
await new Promise(resolve => setTimeout(resolve, 10)); // wait for 2 seconds
table.addRow(file, "cargado");
continue;
}
}

client.application.commands.set(commandsArray);
}

module.exports = { loadCommands };
Index js file
const { loadCommands } = require("./Handlers/cargarComandos");
client.commands = new Collection();

client.login(token).then(() => {
loadEvents(client);
loadCommands(client);
});
const { loadCommands } = require("./Handlers/cargarComandos");
client.commands = new Collection();

client.login(token).then(() => {
loadEvents(client);
loadCommands(client);
});
why?
treble/luna
treble/luna•7mo ago
because you only should register them once and run the file when you add or edit commands
d.js docs
d.js docs•7mo ago
guide Creating Your Bot: Registering slash commands read more
Zer0 🥀
Zer0 🥀•7mo ago
But before worked now not why?
treble/luna
treble/luna•7mo ago
shrug are being really unclear with 'it doesnt work' and you are better off using a separate script regardless
Zer0 🥀
Zer0 🥀•7mo ago
like before once I restart bot commands where updated the description and all that but now not
treble/luna
treble/luna•7mo ago
well did you update the description and refresh your discord client
Zer0 🥀
Zer0 🥀•7mo ago
my client not I added a command and restarted my bot
treble/luna
treble/luna•7mo ago
make sure its in the right directory then
Zer0 🥀
Zer0 🥀•7mo ago
seemed restarting the client worked but why does this happen?
treble/luna
treble/luna•7mo ago
thats just discord
Zer0 🥀
Zer0 🥀•7mo ago
okay
treble/luna
treble/luna•7mo ago
i still recommend reading this though
Zer0 🥀
Zer0 🥀•7mo ago
thanks for your support