for some reason, the commands stopped registering

today I decided to add commands to the bot , I wrote a command, I launch the bot to test it , I enter / and there is no command that I added, I tried to create a new bot on the portal, I changed the client id, token in the new bot, no commands are registered at all
5 Replies
d.js toolkit
d.js toolkit10mo 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!
Martoz
MartozOP10mo ago
const readCommands = (directory) => {
const commandFiles = fs.readdirSync(directory, { withFileTypes: true });
for (const file of commandFiles) {
if (file.isDirectory()) {
readCommands(`${directory}/${file.name}`);
} else if (file.name.endsWith('.js')) {
const command = require(`${directory}/${file.name}`);
if (command.data && command.data.name) {
client.commands.set(command.data.name, command);
console.log(`✅ Команда ${command.data.name} успешно зарегистрирована.`);
} else {
console.error(`❌ Неверный формат данных для команды в файле ${file.name}`);
}
}
}
};


readCommands('./commands');
readCommands('./moderator');
readCommands('./voicecommands')
const readCommands = (directory) => {
const commandFiles = fs.readdirSync(directory, { withFileTypes: true });
for (const file of commandFiles) {
if (file.isDirectory()) {
readCommands(`${directory}/${file.name}`);
} else if (file.name.endsWith('.js')) {
const command = require(`${directory}/${file.name}`);
if (command.data && command.data.name) {
client.commands.set(command.data.name, command);
console.log(`✅ Команда ${command.data.name} успешно зарегистрирована.`);
} else {
console.error(`❌ Неверный формат данных для команды в файле ${file.name}`);
}
}
}
};


readCommands('./commands');
readCommands('./moderator');
readCommands('./voicecommands')
I didn't touch the code until today, everything worked fine Oh, sorry, I didn't see where I was writing I launched a new bot and changed the clientid and token, but the commands are not registered there either the script with the command registration is located in the index.js to launch the bot You need to drop the lines where the command is registered or the entire index.js? oh index.js is very big
Martoz
MartozOP10mo ago
d.js docs
d.js docs10mo ago
:guide: Creating Your Bot: Registering slash commands The command deployment script, to register your slash commands with Discord so they appear in the interface. read more
Martoz
MartozOP10mo ago
Strangely, everything worked fine before that Okay, thanks @Qjuh hi, the commands are successfully registered, but now for some reason they have stopped working, the bot responds to the commands The application did not respond I'll try it right now Command "verify" not found although she has registered
Want results from more Discord servers?
Add your server