aboutsummaryrefslogtreecommitdiff
path: root/src/hypixel.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-17 17:43:30 +0000
committermat <github@matdoes.dev>2022-05-17 17:43:30 +0000
commit5101e436bd2acfb6efdffe5c8c723511ab735153 (patch)
tree014d8a95693017e1e89cb254a45896422a650bbb /src/hypixel.ts
parented72217fd73eca1de929f915056e13be9d4085f9 (diff)
downloadskyblock-api-5101e436bd2acfb6efdffe5c8c723511ab735153.tar.gz
skyblock-api-5101e436bd2acfb6efdffe5c8c723511ab735153.tar.bz2
skyblock-api-5101e436bd2acfb6efdffe5c8c723511ab735153.zip
improve auctions api
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r--src/hypixel.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts
index d4e1a49..88f3768 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -32,6 +32,7 @@ import * as cached from './hypixelCached.js'
import { debug } from './index.js'
import { WithId } from 'mongodb'
import { cleanEndedAuctions } from './cleaners/skyblock/endedAuctions.js'
+import { cleanAuctions } from './cleaners/skyblock/auctions.js'
export type Included = 'profiles' | 'player' | 'stats' | 'inventories' | undefined
@@ -63,6 +64,7 @@ const cleanResponseFunctions = {
'skyblock/profile': (data: typedHypixelApi.SkyBlockProfileResponse, options) => cleanSkyblockProfileResponse(data.profile, options),
'skyblock/profiles': (data, options) => cleanSkyblockProfilesResponse(data.profiles),
'skyblock/auctions_ended': (data, options) => cleanEndedAuctions(data),
+ 'skyblock/auction': (data, options) => cleanAuctions(data),
'resources/skyblock/election': (data, options) => cleanElectionResponse(data),
'resources/skyblock/items': (data, options) => cleanItemListResponse(data),
} as const
@@ -360,6 +362,13 @@ export async function fetchItemList() {
return itemList
}
+export async function fetchAuctionUncached(uuid: string) {
+ return await sendCleanApiRequest(
+ 'skyblock/auction',
+ { uuid }
+ )
+}
+
// this function is called from database.ts so it starts when we connect to the database
// it should only ever be called once!
export async function periodicallyFetchRecentlyEndedAuctions() {
@@ -398,7 +407,7 @@ export async function periodicallyFetchRecentlyEndedAuctions() {
}
const simpleAuction: SimpleAuctionSchema = {
- success: true,
+ s: true,
coins: auction.coins,
id: auction.id,
ts: Math.floor(auction.timestamp / 1000),