Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

443
Views
Discord.js ReferenceError: channel is not defined while trying to test an embed

I am working on a discord bot and I was trying to test an embed and an error popped up saying

ReferenceError: channel is not defined

This is the code for the embed

client.on('message', (message) => {
  console.log(`[${message.author.tag}]: ${message.content}`);
  if (message.content === 'brh!testembed') {
    const exampleEmbed = new Discord.MessageEmbed()
     .setColor('#0099ff')
     .setTitle('Some title')
     .setURL('https://discord.js.org/')
     .setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
     .setDescription('Some description here')
     .setThumbnail('https://i.imgur.com/wSTFkRM.png')
     .addFields(
         { name: 'Regular field title', value: 'Some value here' },
         { name: '\u200B', value: '\u200B' },
         { name: 'Inline field title', value: 'Some value here', inline: true },
         { name: 'Inline field title', value: 'Some value here', inline: true },
     )
     .addField('Inline field title', 'Some value here', true)
     .setImage('https://i.imgur.com/wSTFkRM.png')
     .setTimestamp()
     .setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
      channel.send(exampleEmbed);
    
    }
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Like the error says you have not defined channel if you want to send the embed to the same channel as your command was used in just do:

message.channel.send(exampleEmbed);

If you are using v13 use:

message.channel.send({embeds: [exampleEmbed]});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!