register slash commands doesn't work

hello i used snippet from discordjs.guide for register slash commands, exactly this https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands and after use node deploy-commands.js nothing shows even console.log included in async function, what i do incorrect?
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
4 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
wisienka
wisienkaOP2y ago
[email protected] /root/discord
[email protected] /root/discord
deploy-commands.js
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');

const commands = [
{
name: 'test',
description: 'to jest testowa komenda',
},
];

const rest = new REST({ version: '10' }).setToken(token);

(async () => {
console.log('Wykonuje');
try {
console.log('Zaczynam rejestrować komendy slash!');
await rest.put(
Routes.applicationCommands(clientId),
{ body: commands }
)
console.log('Komendy slash zostały zarejestrowane!');
} catch (error) {
console.error(error);
}
});
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');

const commands = [
{
name: 'test',
description: 'to jest testowa komenda',
},
];

const rest = new REST({ version: '10' }).setToken(token);

(async () => {
console.log('Wykonuje');
try {
console.log('Zaczynam rejestrować komendy slash!');
await rest.put(
Routes.applicationCommands(clientId),
{ body: commands }
)
console.log('Komendy slash zostały zarejestrowane!');
} catch (error) {
console.error(error);
}
});
chewie
chewie2y ago
you are missing the () at the end of the async function, like in the guide a thanks would have been nice angery
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server