diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-11 18:44:09 +0200 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-11 18:44:09 +0200 |
commit | d2a020837267bf024f508b402f596f8e242672ed (patch) | |
tree | 7e371015fa1451bda993e44aa591b3cc24c3209d /src/tasks/updatePriceItemCache.ts | |
parent | 7d1dede862339c439830a0306e2b7f3a273f967f (diff) | |
download | tanzanite-d2a020837267bf024f508b402f596f8e242672ed.tar.gz tanzanite-d2a020837267bf024f508b402f596f8e242672ed.tar.bz2 tanzanite-d2a020837267bf024f508b402f596f8e242672ed.zip |
create task categories
Diffstat (limited to 'src/tasks/updatePriceItemCache.ts')
-rw-r--r-- | src/tasks/updatePriceItemCache.ts | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/tasks/updatePriceItemCache.ts b/src/tasks/updatePriceItemCache.ts deleted file mode 100644 index 5f68a8c..0000000 --- a/src/tasks/updatePriceItemCache.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BushTask, Time } from '#lib'; -import got from 'got'; -import PriceCommand, { AuctionAverages, Bazaar, LowestBIN } from '../commands/utilities/price.js'; - -export default class UpdatePriceItemCache extends BushTask { - public constructor() { - super('updatePriceItemCache', { - delay: 10 * Time.Minute, - runOnStart: true - }); - } - - public async exec() { - const [bazaar, currentLowestBIN, averageLowestBIN, auctionAverages] = (await Promise.all( - PriceCommand.urls.map(({ url }) => got.get(url).json().catch(undefined)) - )) as [Bazaar?, LowestBIN?, LowestBIN?, AuctionAverages?]; - - const itemNames = new Set([ - ...Object.keys(averageLowestBIN ?? {}), - ...Object.keys(currentLowestBIN ?? {}), - ...Object.keys(auctionAverages ?? {}), - ...Object.keys(bazaar?.products ?? {}) - ]); - - PriceCommand.cachedItemList = [...itemNames]; - } -} |