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

216
Vistas
How to create a embed for a API response for a Discord Bot

I have added a API response to my Discord Bot and want to know how to format this API response into a embed to make it look nice when it gets sent in Discord

Here is my code:

const ifliveService = require("../utils/InfiniteFlightLive")
const ifl = new ifliveService()

module.exports = {
    category: "Userstats",
    description: "Fetches the users states from Discourse.",
    expectedArgs: '<ifc username>',
    minArgs: 1,
    maxArgs: 1,
    callback: async ({channel, args}) => {
        const username = args[0]
        
        const userstats = await ifl.getUserStats(username)
        if(!userstats || userstats.result == []) return "Invalid user"
        return JSON.stringify(userstats.result[0], null, '\t')
         }
     }

I want to return that base reply into a embed how would that be possible? Please note I am a bit of a beginner with all of this so I apologize if it is a quick and easy solution.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can create an embed like this:

const { MessageEmbed } = require("discord.js");

const embed = new MessageEmbed()
    .setTitle("Your title here")
    .setDescription("Your description here")
    .addField("Field name", "Field value");

// Using Discord.js v13
message.channel.send({ embeds: [ embed ] });

Add as many fields as you like using addField(). You can learn more about embeds in the official documentation.

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