Slash Commands were showing just fine, then they disappeared after a server restart

Hi, I was updating my bot, the commands were showings in the serv, and all of sudden after a restart of the bot, they stop showing, I tried to invite my bot in another server and only two commands are showing, yet in the console of the server I got no message errors and its showing me all the commands are loaded.
7 Replies
d.js toolkit
d.js toolkit5mo 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!
Freed
FreedOP5mo ago
function chargerCommandes(client) {
const ascii = require("ascii-table");
const fs = require("fs");
const table = new ascii().setHeading("Commandes", "Status");

var publicArray = [];
var fichesArray = [];

const folders = fs.readdirSync("./Commandes");

for (const folder of folders) {
const files = fs
.readdirSync(`./Commandes/${folder}`)
.filter((file) => file.endsWith(".js"));

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

client.commands.set(commandFile.data.name, commandFile);

if (commandFile.fiches) fichesArray.push(commandFile.data.toJSON());
else publicArray.push(commandFile.data.toJSON());

table.addRow(file, "✅");
continue;
}
}

const fichesGuild = client.guilds.cache.get(client.config.fichesGuild);
const publicGuild = client.guilds.cache.get(client.config.publicGuild);

fichesGuild.commands.set(fichesArray);
publicGuild.commands.set(publicArray);

return console.log("Commandes Chargées.\n", table.toString());
}

module.exports = { chargerCommandes };
function chargerCommandes(client) {
const ascii = require("ascii-table");
const fs = require("fs");
const table = new ascii().setHeading("Commandes", "Status");

var publicArray = [];
var fichesArray = [];

const folders = fs.readdirSync("./Commandes");

for (const folder of folders) {
const files = fs
.readdirSync(`./Commandes/${folder}`)
.filter((file) => file.endsWith(".js"));

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

client.commands.set(commandFile.data.name, commandFile);

if (commandFile.fiches) fichesArray.push(commandFile.data.toJSON());
else publicArray.push(commandFile.data.toJSON());

table.addRow(file, "✅");
continue;
}
}

const fichesGuild = client.guilds.cache.get(client.config.fichesGuild);
const publicGuild = client.guilds.cache.get(client.config.publicGuild);

fichesGuild.commands.set(fichesArray);
publicGuild.commands.set(publicArray);

return console.log("Commandes Chargées.\n", table.toString());
}

module.exports = { chargerCommandes };
here is my commands handler juste in case normally all commands were showing just fine in the main server, then they disappeared it is indeed, and no, i was just restarting for testing new changes to an already working commands, all the commands disappeared when i did a restart just to add a console.log for a checking, sorry about my bad understanding about english btw idk wdym about de fiches properties btw i thinks i can just remove the other server stuff, i don't need it anymore if it will helps probably because there is json stuff around i guess i will try yea
//const fichesGuild = client.guilds.cache.get(client.config.fichesGuild);
const publicGuild = client.guilds.cache.get(client.config.publicGuild);

//fichesGuild.commands.set(fichesArray);
publicGuild.commands.set(publicArray);
//const fichesGuild = client.guilds.cache.get(client.config.fichesGuild);
const publicGuild = client.guilds.cache.get(client.config.publicGuild);

//fichesGuild.commands.set(fichesArray);
publicGuild.commands.set(publicArray);
tried this, still not working all commands are showing as up in the console btw yes i will check
Freed
FreedOP5mo ago
it's telling the bot as no commands
No description
Freed
FreedOP5mo ago
i did it like 5 time lmao the weirdest things that put me in incomprehension, is that it was working just fine, and then it disappeared ig im just stuck and i cant find why :x yet even after all that the two tickets commands are still showing and working in the other serv did a console.log to look at it
21.07 22:41:36 [Bot] [
21.07 22:41:36 [Bot] {
21.07 22:41:36 [Bot] options: [ [Object], [Object], [Object] ],
21.07 22:41:36 [Bot] name: 'argent',
21.07 22:41:36 [Bot] name_localizations: undefined,
21.07 22:41:36 [Bot] description: "Configure l'argent d'un joueur",
21.07 22:41:36 [Bot] description_localizations: undefined,
21.07 22:41:36 [Bot] default_permission: undefined,
21.07 22:41:36 [Bot] default_member_permissions: '2048',
21.07 22:41:36 [Bot] dm_permission: false,
21.07 22:41:36 [Bot] nsfw: undefined
21.07 22:41:36 [Bot] },
21.07 22:41:36 [Bot] {
21.07 22:41:36 [Bot] options: [ [Object] ],
21.07 22:41:36 [Bot] name: 'débloquer-rang',
21.07 22:41:36 [Bot] name_localizations: undefined,
21.07 22:41:36 [B

...
21.07 22:41:36 [Bot] [
21.07 22:41:36 [Bot] {
21.07 22:41:36 [Bot] options: [ [Object], [Object], [Object] ],
21.07 22:41:36 [Bot] name: 'argent',
21.07 22:41:36 [Bot] name_localizations: undefined,
21.07 22:41:36 [Bot] description: "Configure l'argent d'un joueur",
21.07 22:41:36 [Bot] description_localizations: undefined,
21.07 22:41:36 [Bot] default_permission: undefined,
21.07 22:41:36 [Bot] default_member_permissions: '2048',
21.07 22:41:36 [Bot] dm_permission: false,
21.07 22:41:36 [Bot] nsfw: undefined
21.07 22:41:36 [Bot] },
21.07 22:41:36 [Bot] {
21.07 22:41:36 [Bot] options: [ [Object] ],
21.07 22:41:36 [Bot] name: 'débloquer-rang',
21.07 22:41:36 [Bot] name_localizations: undefined,
21.07 22:41:36 [B

...
thats what we have in the array for each commands
Freed
FreedOP5mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Freed
FreedOP5mo ago
i tried to remake this one way of commands handler and it doesnt works too after some console.log it looks like this part didn't works
const data = await rest.put(
Routes.applicationGuildCommands("clientid", "servid"),
{ body: publicArray },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
const data = await rest.put(
Routes.applicationGuildCommands("clientid", "servid"),
{ body: publicArray },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
Update i tried to remove everything i did come back to my original bot create a new bot in the discord portal and just got back the commands like wtf the commands disappeared again :Thonk:
Amgelo
Amgelo5mo ago
could you show your current full deploy script?
Want results from more Discord servers?
Add your server