Send Embed to Channel with ID
I would like to send my embed to a channel specified by ID. Unfortunately it doesn't work in my code.
const { EmbedBuilder, ButtonInteraction } = require("discord.js");
module.exports = {
name: "interactionCreate",
once: false,
/**
*
* @param {ButtonInteraction} interaction
* @param {*} client
*/
async execute(interaction, client) {
if(interaction.isButton()) {
if(interaction.customId == "einstempeln") {
const channel = client.channels.cache.get('1222955254174453945');
if (!channel) return console.log("Channel not found");
const embed = new EmbedBuilder()
.setColor(0x6AA84F)
.setTitle('Dienst-Eintragung')
.setDescription('Du hast dich erfolgreich in den Dienst eingetragen!')
.setTimestamp()
.setFooter({text: 'Benni Techniker'});
channel.send({embeds: [embed]});
}
}
}
}const { EmbedBuilder, ButtonInteraction } = require("discord.js");
module.exports = {
name: "interactionCreate",
once: false,
/**
*
* @param {ButtonInteraction} interaction
* @param {*} client
*/
async execute(interaction, client) {
if(interaction.isButton()) {
if(interaction.customId == "einstempeln") {
const channel = client.channels.cache.get('1222955254174453945');
if (!channel) return console.log("Channel not found");
const embed = new EmbedBuilder()
.setColor(0x6AA84F)
.setTitle('Dienst-Eintragung')
.setDescription('Du hast dich erfolgreich in den Dienst eingetragen!')
.setTimestamp()
.setFooter({text: 'Benni Techniker'});
channel.send({embeds: [embed]});
}
}
}
}