1

Hello I am wondering if there are any syntax errors in the following code which would prevent the symbol, name, and price from pulling through:

if (command === 'getQuote') {
    let getQuote = async () => {
    let response = await axios.get(
        'https://financialmodelingprep.com/api/v3/quote/AAPL?apikey=demo'
    );
    
    let quote = response.data
        return quote
    };
    let quoteValue = await getQuote();
    console.log(quoteValue);
    message.reply(
        `Heres your quote\n${quoteValue.symbol}\n\n${quoteValue.name}\n\n${quoteValue.price}`
    );
}
Jakye
  • 6,440
  • 3
  • 19
  • 38
dilonv2
  • 53
  • 8

1 Answers1

1

It seems that you're getting an array back from the API, but you're treating the quoteValue as an object instead.

Check this codesandbox:

https://codesandbox.io/s/infallible-dan-4nc4m?file=/src/index.js

Jan Richter
  • 1,976
  • 4
  • 29
  • 49
  • Thank you so much. I see it printing in console in the sandbox, but still nothing in Discord. You can see in these images, the joke code is the same, but working - https://imgur.com/SOizv3m ... https://imgur.com/b3KrjiF – dilonv2 Aug 09 '20 at 02:40
  • Thank you. This does work. Apparently changing getQuote to getquote worked as the command? – dilonv2 Aug 09 '20 at 16:46