#No error output

1 messages · Page 1 of 1 (latest)

mellow phoenix
#

When running the /ping command on my server, the command instantly fails. The bot doesn't produce any other error. How can I get Discord to produce an error I can act on?

#

The console produces nothing either.

#

I'll send a code snippit in a sec

night crystal
#

You don’t reply to the interactionCreate event or your bot isn’t even online

mellow phoenix
#

The bot is online because it sends a message into a channel when it starts.

const { SlashCommandBuilder, EmbedBuilder } = require('discord.js')

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('The holy grail of Discord bot commands. What 90% of all these commands are based on.'),
    async execute(interaction) {
        const embed = new EmbedBuilder()
            .setTitle(`PONG!`)
            .setFooter({ text: process.env.FOOTER_TEXT, iconURL: interaction.client.user.avatarURL() })
        return interaction.reply({ embeds: [embed] })
    }
}
#

If it matters at all, this code is from a bot I stopped working on a month and a half ago. I just started working on it again today.

#

I npm upgradeed

night crystal
#

And you have an InteractionCreate handler that calls this?

mellow phoenix
#
client.on('interactionCreate', async interaction => {
    if (!interaction.isChatInputCommand()) return
    const guild = client.guilds.cache.get(process.env.GUILD_ID)
    const command = client.commands.get(interaction.commandName)
    if (!command) return
    try {
        await command.execute(interaction)
        console.log(`Command ${interaction.commandName} executed by ${interaction.user.tag}`)
    }
    catch (error) { console.error(error); await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }) }
})
night crystal
#

If you don’t get any output in your console then this code isn’t executed at all

mellow phoenix
#

I even set client.on('debug', console.log) and I can't find anything wrong on the code-side of things...

Provided token: [REDACTED]
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
    URL: wss://gateway.discord.gg
    Recommended Shards: 1
[WS => Manager] Session Limit Information
    Total: 1000
    Remaining: 986
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
    Gateway    : wss://gateway.discord.gg/
    Version    : 10
    Encoding   : json
    Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 250ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 1795
[WS => Shard 0] [READY] Session [REDACTED].
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Wee6 is now online! - Wee6#****
[WS => Shard 0] Heartbeat acknowledged, latency of 110ms.
#

I tried to execute the commands several times after I started the bot with these logs