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

153
Views
When sending embeds, should the last line be channel.send({ embeds: [exampleEmbed] })?

I'm kind of stuck with this portion of the code. I'm currently coding a discord bot for a school project as well as personal use. The main purpose of the discord bot is to send embeds and casual commands where someone says "goodnight" and the bot will respond goodnight. For the goodnight part of the code, I have it pretty much written correctly, but how do I get it to respond by tagging the persons discord tag? such as instead of my current code being else if (message.content === 'goodnight'){ message.channel.send('Goodnight!'); How would I get it to say "Goodnight @discordtag"

Secondly, the embed portion of the code is what I'm struggling with the most. I'm pretty much following the guides on https://discordjs.guide as well as some youtube videos, but I seem to not be able to find the answer. I'm getting the error "channel.send({ embeds: [exampleEmbed] }); ^

TypeError: Cannot read properties of undefined (reading 'send')

My code for the example embed is:

const channel = client.channels.cache.get('912186200910102559')
const exampleEmbed = new MessageEmbed()
        .setColor('#5104DB')
        .setTitle("Boombap's Cookout Rules")
        .setAuthor({ name: 'Rules', iconURL: 'https://gridfiti.com/wp-content/uploads/2021/04/Gridfiti_Blog_AnimeCars_NissanSilviaS13.jpg'})
        .addFields(
            { name: 'Rule 1', value: 'No racist, sexist or any type of hate speech towards other members.'},
            { name: 'Rule 2', value: 'No scamming.'},
            { name: 'Rule 3', value: 'No discussions of anything illegal, if you think it might be just do not mention it in the discord.'},
            { name: 'Rule 4', value: 'No advertisements of other services.'}

        )

channel.send({ embeds: [exampleEmbed] });
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

To answer the first part of your question, you can mention the user by Goodnight ${message.author} or Goodnight <@${message.author.id}> - both will return the same value (the discord mention).

channel is undefined, so that means there is no attribute send() as the error suggests. You can either fetch/cache a channel to send to a specific channel such as

const channel = client.channels.cache.get('ID');

Or use the attribute channel on the message - message.channel.send() DJS Docs: Message: channel

about 4 years ago · Juan Pablo Isaza Report

0

What is channel defined as? Try replacing channel with message.channel

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!