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

141
Vistas
Discord.js Button on Embed

I would like to make this send an embed instead of it saying "If you want to apply, click the button below.", and have the apply button underneath the embed I have read up about some Component array and embed array stuff but I can't seem to get anything working with that If anyone could help me out id appreciate it 🙂

Two very helpful people have helped me

@Skulaurun Mrusal and @PerplexingParadox

Thank you! 🙂

enter image description here

client.on("message", async (message) => {
      // Don't reply to bots
  if (message.author.bot) return;

  if (message.content == "#req") {
         if(!message.member.hasPermission("MANAGE_MESSAGES"))
     {
        message.reply("You do not have permission to do that!");
        return;
     }
    // Perform raw API request and send a message with a button,
    // since it isn't supported natively in discord.js v12
    client.api.channels(message.channel.id).messages.post({
      data: {
        embeds: [reqEmbed],
        components: [
          {
            type: 1,
            components: [
              {
                type: 2,
                style:  4,
                label: "Apply",
                // Our button id, we can use that later to identify,
                // that the user has clicked this specific button
                custom_id: "send_application"
              }
            ]
          }
        ]
      }
    });
  }
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You only need to modify your code with one line. You just have to send your exampleEmbed through the Discord API post instead of using the discord.js method.

To do that, all you have to do is add an embeds field, which takes in an array of embed objects, which you have conveniently labeled as exampleEmbed, and put it there.

Like this:

client.api.channels(message.channel.id).messages.post({
    data: {
        //adds the embed here, so the button and embed will be sent together
        embeds: [exampleEmbed],
        components: [
            {
                type: 1,
                components: [
                    {
                        type: 2,
                        style: 1,
                        label: "Apply",
                        // Our button id, we can use that later to identify,
                        // that the user has clicked this specific button
                        custom_id: "send_application"
                    }
                ]
            }
        ],
    }
});

Here's the Discord API documentation for reference.


In addition, it seems like discord.js v13 also supports buttons as well, but since it's been released pretty recently, I haven't had time to check it out.

Discord.js Guide

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