#Application Guild Command Creating

1 messages · Page 1 of 1 (latest)

zenith laurel
#

This is basic debugging, just add console.log() before each action, to see which is executed and which isn't

#

Since you're not getting any errors nor output

#

@cunning goblet

cunning goblet
#

oh i see

#
client.on('interactionCreate', async interaction => {
    console.log('create') 
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});```
#

this one it is it wont console.log

zenith laurel
#

I meant the file you use to register the commands

cunning goblet
#
const fs = require('node:fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientId, guildId, token } = require('./config.json');

const commands = [];
const commandFiles = fs.readdirSync('./commands').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: '9' }).setToken(token);

rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
    .then(() => console.log('Successfully registered application commands.'))
    .catch(console.error);``` if u meant this one there is a .catch(console.error)
#

also if u need for console.log

#

it does not print that