Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!