blob: 43bd9fd3ce2efcfbffed3db97da56ed3f74a5a5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import { Included } from '../../hypixel'
import * as cached from '../../hypixelCached'
import { CleanPlayer } from '../player'
import { Bank, cleanBank } from './bank'
import { CleanMinion, cleanMinions } from './minions'
import { CleanProfileStats, cleanProfileStats } from './stats'
export interface CleanBasicMember {
uuid: string
username: string
last_save: number
first_join: number
}
export interface CleanMember extends CleanBasicMember {
stats?: CleanProfileStats
minions?: CleanMinion[]
bank?: Bank
}
/** Cleans up a member (from skyblock/profile) */
export async function cleanSkyBlockProfileMemberResponse(member, included: Included[] = null): Promise<CleanMember> {
// profiles.members[]
const statsIncluded = included == null || included.includes('stats')
return {
uuid: member.uuid,
username: await cached.usernameFromUser(member.uuid),
last_save: member.last_save,
first_join: member.first_join,
// last_death: ??? idk how this is formatted,
stats: statsIncluded ? cleanProfileStats(member?.stats) : undefined,
minions: statsIncluded ? cleanMinions(member?.crafted_generators) : undefined,
}
}
export interface CleanMemberProfilePlayer extends CleanPlayer {
// The profile name may be different for each player, so we put it here
profileName: string
first_join: number
last_save: number
bank?: Bank
}
export interface CleanMemberProfile {
member: CleanMemberProfilePlayer
profile: {
}
}
|