From ac8f3d0b260639aadc819f2d46beafe3ce2aeaae Mon Sep 17 00:00:00 2001 From: = Date: Tue, 13 Jul 2021 21:55:14 -0400 Subject: [PATCH] add basics for stock quotes --- commands/stonk.js | 24 ++++++++++++++++++++++++ functions.js | 7 +++++++ 2 files changed, 31 insertions(+) create mode 100644 commands/stonk.js diff --git a/commands/stonk.js b/commands/stonk.js new file mode 100644 index 0000000..d388482 --- /dev/null +++ b/commands/stonk.js @@ -0,0 +1,24 @@ +var axios = require("axios").default; + +var options = { + method: 'GET', + url: 'https://yahoo-finance-low-latency.p.rapidapi.com/v6/finance/quote', + params: {symbols: ''}, + headers: { + 'x-rapidapi-key': '0b3f85bcb7msh1e6e80e963c9914p1d1934jsnc3542fc83520', + 'x-rapidapi-host': 'yahoo-finance-low-latency.p.rapidapi.com' + } +}; + +module.exports = { + name: 'stonk', + description: 'Get stonk details from Yahoo Finance', + execute(message, file) { + options.params.symbols = file.name; + axios.request(options).then(function (response) { + + }).catch(function (error) { + console.error(error); + }); + } +} \ No newline at end of file diff --git a/functions.js b/functions.js index b363a3e..d124f69 100644 --- a/functions.js +++ b/functions.js @@ -97,5 +97,12 @@ module.exports = { .setDescription(data.content) .setTimestamp() .setFooter(`@${author.username}#${author.discriminator}`); + }, + createStockEmbed(data, author, command) { + return new Discord.MessageEmbed() + .setAuthor(command) + .setTitle() + .setTimestamp() + .setFooter(`@${author.username}#${author.discriminator}`); } } \ No newline at end of file