aboutsummaryrefslogtreecommitdiff
path: root/src/hypixel.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-20 22:35:49 -0500
committermat <github@matdoes.dev>2022-03-20 22:35:49 -0500
commit68a0b0778dda3d8bd8bc1763c2370273d456326c (patch)
tree25fdbc058f76ad6daaa55c7b466d45d625804465 /src/hypixel.ts
parentc467866d8eb9634f2cc7c441ee3735c49e6970d2 (diff)
downloadskyblock-api-68a0b0778dda3d8bd8bc1763c2370273d456326c.tar.gz
skyblock-api-68a0b0778dda3d8bd8bc1763c2370273d456326c.tar.bz2
skyblock-api-68a0b0778dda3d8bd8bc1763c2370273d456326c.zip
Add the "left" field for members who left
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r--src/hypixel.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts
index 285ac4e..6691e97 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -87,9 +87,10 @@ export interface CleanUser {
/**
- * Higher level function that requests the api for a user, and returns the cleaned response
+ * Higher level function that requests the api for a user, and returns the
+ * cleaned response. This is used by the /player/<name> route.
* This is safe to fetch many times because the results are cached!
- * @param included lets you choose what is returned, so there's less processing required on the backend
+ * @param included lets you choose what is returned, so there's less processing required on the backend.
* used inclusions: player, profiles
*/
export async function fetchUser({ user, uuid, username }: UserAny, included: Included[]=['player'], customization?: boolean): Promise<CleanUser | null> {
@@ -98,7 +99,7 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc
if (!username && !user) return null
uuid = await cached.uuidFromUser((user ?? username)!)
}
- if (!uuid) {
+ if (!uuid) {
// the user doesn't exist.
if (debug) console.debug('error:', user, 'doesnt exist')
return null
@@ -117,6 +118,7 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc
// if not including profiles, include lightweight profiles just in case
if (!includeProfiles)
basicProfilesData = playerData?.profiles
+ // we don't want the `profiles` field in `player`
if (playerData)
delete playerData.profiles
}
@@ -255,11 +257,11 @@ export async function fetchMemberProfile(user: string, profile: string, customiz
export async function fetchMemberProfilesUncached(playerUuid: string): Promise<CleanFullProfile[]> {
- const profiles: CleanFullProfile[] = await sendCleanApiRequest({
- path: 'skyblock/profiles',
- args: {
- uuid: playerUuid
- }},
+ const profiles: CleanFullProfile[] = await sendCleanApiRequest(
+ {
+ path: 'skyblock/profiles',
+ args: { uuid: playerUuid }
+ },
undefined,
{
// only the inventories for the main player are generated, this is for optimization purposes