Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda