Unknown interaction

Hello i keep getting the "unknown interaction" error like 7 out of 10 times every time i run a slash command or use any component i'll share my InteractionCreate event and one of my slash commands:

const { Events } = require('discord.js');

module.exports = {
    name: Events.InteractionCreate,

    eventCallback: async (interaction, client) => {
        if (interaction.isChatInputCommand()) {
            for (const command of interaction.client.commands) {
                if (command.name === interaction.commandName) {
                    await command.callback(interaction)
                }
            }
        }

        

        else {
            const ticketHandler = require("./ticketInteraction.js");
            await ticketHandler(interaction);
        }
    }
};


ping.js:
module.exports = {
    name: 'ping',
    description: 'Replies with Pong!',

    callback: async (interaction) => {
    await interaction.deferReply();

    const reply = await interaction.fetchReply();

    const ping = reply.createdTimestamp - interaction.createdTimestamp;

    interaction.editReply(`Pong! Client ${ping}ms | Websocket: ${interaction.client.ws.ping}ms`)
    }
};


i can share my event handler or more code if needed
Was this page helpful?