buddy

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 0e1d71709ec4b2efd8e140acf8ee9a5f128d7d4a
parent c71dd1948bebfbfe3bef5516b20483582741a250
Author: underd0g1 <hide4@comcast.net>
Date:   Sat, 12 Sep 2020 23:20:36 -0400

finished stocks api query

Diffstat:
Mlib/3party.js | 13+++++++++----
Mlib/processing.js | 2+-
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/3party.js b/lib/3party.js @@ -8,7 +8,7 @@ const urls = { foas1: 'https://www.foaas.com/operations', foas2:'https://www.foaas.com', code: 'https://api.github.com/repos/underd0g1/buddy', - stocks: 'https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL' + stocks: 'https://query1.finance.yahoo.com/v7/finance/quote?symbols=' } @@ -96,11 +96,16 @@ const code = async(recievedMessage) => { } -const stocks = async(receivedMessage)=>{ - var req = await fetch(urls.stocks); +const stocks = async(arguements, message)=>{ +//if they type one symbol. +// if they type more than one +// if they type invalid ones +console.log("just args: " +arguements) +console.log("index 0 " + arguements[0]); + var req = await fetch(urls.stocks+arguements[0]); var data = await req.json(); console.log(data.quoteResponse.result); - return data.quoteResponse.result[0].symbol + data.quoteResponse.result[0].regularMarketPrice + return data.quoteResponse.result[0].displayName + ": $ "data.quoteResponse.result[0].regularMarketPrice } diff --git a/lib/processing.js b/lib/processing.js @@ -33,7 +33,7 @@ const tool = require("./tools.js"); message.channel.send(await apiroute.foas1()); break; case "stocks": - message.channel.send(await apiroute.stocks()); + message.channel.send(await apiroute.stocks(arguements, message)); break; default: tool.help(arguements, message);