diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database.ts | 6 | ||||
-rw-r--r-- | src/hypixel.ts | 5 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/database.ts b/src/database.ts index d0c5da0..4d2eb4d 100644 --- a/src/database.ts +++ b/src/database.ts @@ -118,8 +118,6 @@ export interface AccountSchema { } export interface SimpleAuctionSchemaBson { - /** The UUID of the auction so we can look it up later. */ - id: Binary coins: number /** * The timestamp as **seconds** since epoch. It's in seconds instead of ms @@ -134,8 +132,6 @@ export interface SimpleAuctionSchemaBson { lore: string } export interface SimpleAuctionSchema { - /** The UUID of the auction so we can look it up later. */ - id: string coins: number /** * The timestamp as **seconds** since epoch. It's in seconds instead of ms @@ -1128,7 +1124,6 @@ function toItemAuctionsSchema(i: ItemAuctionsSchemaBson): ItemAuctionsSchema { auctions: i.auctions.map(a => { return { ...a, - id: a.id.toString('hex'), bin: a.bin ?? false } }), @@ -1142,7 +1137,6 @@ function toItemAuctionsSchemaBson(i: ItemAuctionsSchema): ItemAuctionsSchemaBson auctions: i.auctions.map(a => { return { ...a, - id: createUuid(a.id), bin: a.bin ? true : undefined } }), 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) |