unable to setup commands #9811
-
this is the logs i get when i launch my bot
and this is the code const { REST, Routes } = require("discord.js");
const { token, clientID, serverID } = require("./config.json");
const fs = require("node:fs");
const path = require("node:path");
const bot = require("./client");
const commands = [];
const commandsPath = path.join(__dirname, "commands");
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: "10" }).setToken(token);
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
const data = await rest.put(Routes.applicationCommands(clientID, serverID), { body: commands });
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
process.exit(0);
} catch (error) {
console.error(error.message);
}
})(); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Looks like your |
Beta Was this translation helpful? Give feedback.
-
not the minecraft bot does not join and i get this |
Beta Was this translation helpful? Give feedback.
Looks like your
clientID
is undefined and you want to useapplicationGuildCommands
for deploying commands in a guild,applicationCommands
is for deploying commands globally. Check out this guide