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

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

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 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