mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-04-24 06:56:54 -05:00
Show Splatoon 3 presence data in nxapi util discord-activity when using a presence URL
This commit is contained in:
parent
e8cbbd39ca
commit
30418d89b6
|
|
@ -90,7 +90,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
readonly [Presence, CurrentUser | Friend | undefined, unknown] :
|
||||
await getPresenceFromCoral(argv);
|
||||
|
||||
const discordpresence = getActivityFromPresence(argv, presence, user, friendcode, activeevent);
|
||||
const discordpresence = getActivityFromPresence(argv, presence, user, friendcode, activeevent, response);
|
||||
const application = argv.showDiscordApplication ?
|
||||
discordpresence ? await getDiscordApplicationRpc(discordpresence.id) : null : undefined;
|
||||
|
||||
|
|
@ -175,6 +175,7 @@ function getActivityFromPresence(
|
|||
user?: CurrentUser | Friend,
|
||||
friendcode?: CurrentUser['links']['friendCode'],
|
||||
activeevent?: ActiveEvent,
|
||||
proxy_response?: unknown,
|
||||
) {
|
||||
const online = presence?.state === PresenceState.ONLINE || presence?.state === PresenceState.PLAYING;
|
||||
|
||||
|
|
@ -203,6 +204,7 @@ function getActivityFromPresence(
|
|||
activeevent,
|
||||
show_play_time,
|
||||
// znc_discord_presence: this,
|
||||
proxy_response,
|
||||
nsaid: argv.friendNsaid ?? user?.nsaId,
|
||||
user,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ class ZncDiscordPresenceClient {
|
|||
activeevent: this.m.show_active_event ? activeevent : undefined,
|
||||
show_play_time: this.m.show_play_time,
|
||||
znc_discord_presence: this.m,
|
||||
proxy_response: (this.m) instanceof ZncProxyDiscordPresence ? this.m.last_data : undefined,
|
||||
monitors: [...this.monitors.values()],
|
||||
nsaid: this.m.presence_user!,
|
||||
user,
|
||||
|
|
|
|||
|
|
@ -232,9 +232,7 @@ interface PresenceUrlResponse {
|
|||
|
||||
export function callback(activity: DiscordRPC.Presence, game: Game, context?: DiscordPresenceContext) {
|
||||
const monitor = context?.monitors?.find(m => m instanceof SplatNet3Monitor) as SplatNet3Monitor | undefined;
|
||||
const presence_proxy_data =
|
||||
context?.znc_discord_presence instanceof ZncProxyDiscordPresence ?
|
||||
context.znc_discord_presence.last_data as PresenceUrlResponse : null;
|
||||
const presence_proxy_data = context?.proxy_response ? context.proxy_response as PresenceUrlResponse : null;
|
||||
|
||||
const friend = presence_proxy_data?.splatoon3 ?? monitor?.friend;
|
||||
const fest = presence_proxy_data?.splatoon3_fest ?? monitor?.fest;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export interface DiscordPresenceContext {
|
|||
activeevent?: ActiveEvent;
|
||||
show_play_time?: DiscordPresencePlayTime;
|
||||
znc_discord_presence?: ZncDiscordPresence | ZncProxyDiscordPresence;
|
||||
proxy_response?: unknown;
|
||||
monitors?: ExternalMonitor[];
|
||||
nsaid?: string;
|
||||
user?: CurrentUser | Friend;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user