diff --git a/config.js b/config.js index 53d3562..ebf3888 100644 --- a/config.js +++ b/config.js @@ -1,7 +1,7 @@ module.exports = { - channels: ["#elitistjerks"], - server: "NuclearFallout.WA.US.GameSurge.net", - botName: "rememe", + channels: ["#elitistjerks","#buubot"], + server: "irc.gamesurge.net", + botName: "memer", urlSummarizer: { yieldToOtherBots: true, otherBots: ["meme"], diff --git a/modules/quote.js b/modules/quote.js index 813e9b4..f00d3cf 100644 --- a/modules/quote.js +++ b/modules/quote.js @@ -7,24 +7,22 @@ function quote(bot, _words, from, to) { const sendTo = to == _bot.nick ? from : to; YahooStocks.lookup(_words[1]) - .then(function(res) { + .then(function (res) { let curr = res; - YahooStocks.history(_words[1]).then(function(res) { + YahooStocks.history(_words[1]).then(function (res) { let old = res.records[res.records.length - 1].open; let change = curr.currentPrice - old; - let percentage = (change / curr.currentPrice) * 100; + let percentage = (change / old) * 100; percentage = Math.round(percentage * 100) / 100; change = Math.round(change * 100) / 100; bot.say( sendTo, - `${curr.name}: \$${ - curr.currentPrice - }; Change since open: \$${change} (${percentage}%)` + `${curr.name}: \$${curr.currentPrice}; Change since open: \$${change} (${percentage}%)` ); }); }) - .catch(function(err) { + .catch(function (err) { bot.say(sendTo, "quote error " + err); }); } @@ -35,5 +33,5 @@ function setup(bot, commands) { } module.exports = { - setup: setup + setup: setup, }; diff --git a/package.json b/package.json index 0e67edf..d397338 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,6 @@ "pg": "^6.2.4", "request": "^2.88.0", "winston": "latest", - "yahoo-stocks": "^2.0.1" + "yahoo-stocks": "rmzg/yahoo-stocks" } }