me commands arent updating

ive changed the command folder and its still showing commands that arent there
21 Replies
d.js toolkit
d.js toolkit3w 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 OP
monbrey
monbrey3w ago
have you redeployed them?
SHADYBAT
SHADYBATOP3w ago
yeah multiple times it still shows the commands from b4 and not the new ones no error message its confusing
monbrey
monbrey3w ago
Have you reloaded your Discord app?
SHADYBAT
SHADYBATOP3w ago
ive closed it is that the same??
monbrey
monbrey3w ago
Fully closes, not just to the taskbar, yeah
SHADYBAT
SHADYBATOP3w ago
i didnt close it all the way
monbrey
monbrey3w ago
You can use Ctrl + R to refresh it
SHADYBAT
SHADYBATOP3w ago
i just did it and it still shows the commands from before
monbrey
monbrey3w ago
Well then it sounds like the commands havent been re-registered Can you show your script for doing that?
SHADYBAT
SHADYBATOP3w ago
script for the command im tryna make work
No description
SHADYBAT
SHADYBATOP3w ago
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);


console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);


console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
and this is the deploying scripy
monbrey
monbrey3w ago
yeah assuming you run that, it all looks normal though your command has no execute function, so it should log that warning and skip it
SHADYBAT
SHADYBATOP3w ago
yeah it shows that
monbrey
monbrey3w ago
well then
SHADYBAT
SHADYBATOP3w ago
well then... hmmm weird :monoclethink: this sucks how long has yours been not updating ooh what?? maybe you can help me out
monbrey
monbrey3w ago
Yeah you should not turn that on
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
monbrey
monbrey3w ago
You should not have it turned on
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
SHADYBAT
SHADYBATOP3w ago
i dont :dance_spin: I FIGURED IT OUT FOR ME THERE WAS A PROBLEM IN MY DEPLOY WHEN I TRIED TO MAKE MY COMMAND GLOBAL my error was in the deploy your showing the index yk the deploy-commands.js file you dont have that??? ... well that might be the thing well idk then my problem was with the deploy-commands.js file
Want results from more Discord servers?
Add your server