aboutsummaryrefslogtreecommitdiff
path: root/src/hypixel.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-02 15:26:52 -0500
committermat <github@matdoes.dev>2022-07-02 15:26:52 -0500
commit96671eaaa92d2f0b508589a0cd372618d94c7fad (patch)
tree8078776af9276521835f4994fc0fff9d25ba0fde /src/hypixel.ts
parentd1f434f53c73c4b7f6327b168f38441732a4a843 (diff)
downloadskyblock-api-96671eaaa92d2f0b508589a0cd372618d94c7fad.tar.gz
skyblock-api-96671eaaa92d2f0b508589a0cd372618d94c7fad.tar.bz2
skyblock-api-96671eaaa92d2f0b508589a0cd372618d94c7fad.zip
don't store auction ids
might be an even worse idea
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r--src/hypixel.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts
index 70753f7..42a219d 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -401,13 +401,14 @@ export async function periodicallyFetchRecentlyEndedAuctions() {
const simpleAuction: SimpleAuctionSchema = {
s: true,
coins: Math.round(auction.coins / auction.item.count),
- id: auction.id,
ts: Math.floor(auction.timestamp / 1000),
bin: auction.bin,
lore: auction.item.display.lore.join('\n')
}
// make sure the auction isn't already in there
- if (!auctions.find((a) => a.id === simpleAuction.id)) {
+ // we use the timestamp because it's sorta unique enough
+ // (we don't store auction ids in the database because they're too big)
+ if (!auctions.find((a) => a.ts === simpleAuction.ts)) {
auctions.push(simpleAuction)
// keep only the last 100 items
if (auctions.length > 100)