client.on Error

Hello. The first Code block are my Code and the Second is the Error.

const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } = require('discord.js');
const { Client } = require('discord.js');
const client = require('../../../index.js').client;
// Replace 'YOUR_CHANNEL_ID_HERE' with the actual channel ID
const CHANNEL_ID = '1222955254174453945';
const exampleEmbed = new EmbedBuilder()
    .setTitle('Stempeluhr')
    .setThumbnail('https://cdn.pixabay.com/photo/2016/08/19/20/37/time-1606153_1280.png')
    .setDescription(`Sie haben sich erfolgreich eingestempelt: <t:${Date.now()}:R>`);

client.on('interactionCreate', async interaction => {
    if (!interaction.isButton()) return;
    if (interaction.message.id !== interaction.message.id) return;
    if (interaction.customId === 'einstempeln') {
        const channel = client.channels.cache.get(CHANNEL_ID);

        if (channel) {
            await channel.send({ embeds: [exampleEmbed] });
            interaction.message.edit({ components: [] });
            interaction.reply({ content: 'Sie haben sich erfolgreich eingestempelt!', ephemeral: true });
        } else {
            // Handle the case where the channel is not found
            console.log(`Channel with ID ${CHANNEL_ID} not found`);
        }
    }
});
Was this page helpful?