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

281
Views
sending info from api to discord in a message (discord.js)

Hey i have a question about how to send data over to a message in discord.js. The code that im using now is kinda working. Its just giving me the response [Object Object]

client.on("message", msg => {
  var axios = require("axios").default;

var options = {
  method: 'GET',
  url: 'https://matchilling-chuck-norris-jokes-v1.p.rapidapi.com/jokes/random',
  headers: {
    accept: 'application/json',
    'X-RapidAPI-Host': 'matchilling-chuck-norris-jokes-v1.p.rapidapi.com',
    'X-RapidAPI-Key': '0f787e5af5msh468814e0b585173p1cacafjsn7d774dfb44ff'
  }
}
  if(msg.content === "chuck"){
    axios.request(options).then(function (response) {
      let datachuck = response.data
        msg.channel.send(`${datachuck}`)
          console.log(response.data)
     
}).catch(function (error) {
    console.error(error);
});
  }
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

the respone.data is not a object. That's why i'm getting [object, object] So the solution is let datachuck = response.data.value

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!