Embed Channel Not Found

Hello, I've been working with Discord.js for a few days making the switch from discord.py

I'm having an issue on my ban command that isn't on my on_ready command

This is my current code:

try {
            await interaction.deferReply();

            await interaction.guild.members.ban(userToBan, { reason: reason });

            const banEmbed = new EmbedBuilder()
            .setColor(0xFF0000)
            .setTitle('Discord Log // Banned')
            .setDescription(`Ran by ${interaction.author}\nActual Command Finish: ${userToBan.tag} was banned.\nReason: ${reason}`)
      
          const channel = interaction.guild.channels.cache.get(1160603215432265768);
          if (channel) {
            channel.send({ embeds: [banEmbed] });
          } else {
            console.error('Channel not found!');
          }

            await interaction.followUp(`User ${userToBan.tag} was banned.\nReason: ${reason}`);
        } catch (error) {
            console.error('Error banning member:', error);
            await interaction.followUp({ content: 'An error occurred while banning the member.', ephemeral: true });
        }


This error I'm getting is my console.error('Channel not found!'); - It bans the person and gives me the reason in the chat but says the channel is somehow not found. I'm thinking it has something to do with const channel = interaction.guild.channels.cache.get(1160603215432265768); but I'm not 100% sure.
Was this page helpful?