Use Splatoon 3 presence data from custom presence URLs

This commit is contained in:
Samuel Elliott
2022-09-24 23:02:24 +01:00
parent a4d328c72a
commit 72995b1a05
7 changed files with 106 additions and 54 deletions

View File

@@ -97,13 +97,13 @@ export enum RequestId {
VsHistoryDetailQuery = 'cd82f2ade8aca7687947c5f3210805a6',
}
interface NodeList<T, C extends boolean = false> {
interface _NodeList<T, C extends boolean = false> {
nodes: T[];
totalCount: C extends true ? number : never;
}
interface NodeListTotal {
totalCount: number;
}
type NodeList<T, C extends boolean = false> =
C extends true ? _NodeList<T> : Pick<_NodeList<T>, 'nodes'>;
type NodeListTotal = Pick<_NodeList<unknown>, 'totalCount'>;
interface Colour {
a: number;

View File

@@ -239,5 +239,5 @@ export async function getPresenceFromUrl(presence_url: string, useragent?: strin
throw new Error('Invalid presence data');
}
return [presence, user] as const;
return defineResponse([presence, user, data as unknown] as const, response);
}