Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda