diff --git a/src/cli/presence-server.ts b/src/cli/presence-server.ts index 55df914..b449954 100644 --- a/src/cli/presence-server.ts +++ b/src/cli/presence-server.ts @@ -258,6 +258,8 @@ function createApp( if (fest_vote_status) { for (const team of fest_vote_status.teams) { + if (!team.votes || !team.preVotes) continue; + for (const player of team.votes.nodes) { if (player.userIcon.url !== friend.userIcon.url) continue; @@ -273,7 +275,7 @@ function createApp( } } - if (!match.splatoon3_fest_team) { + if (!match.splatoon3_fest_team && fest_vote_status.undecidedVotes) { match.splatoon3_fest_team = null; } } @@ -366,7 +368,7 @@ function createApp( for (const team of fest_vote_status.teams) { const schedule_team = schedules.currentFest?.teams.find(t => t.id === team.id); - if (!schedule_team) continue; // Shouldn't ever happen + if (!schedule_team || !team.votes || !team.preVotes) continue; // Shouldn't ever happen for (const player of team.votes.nodes) { if (player.userIcon.url !== friend.userIcon.url) continue; @@ -385,7 +387,7 @@ function createApp( } } - if (!match_splatnet3_fest_team) { + if (!match_splatnet3_fest_team && fest_vote_status.undecidedVotes) { match_splatnet3_fest_team = null; } } diff --git a/src/discord/titles/nintendo/splatoon3.ts b/src/discord/titles/nintendo/splatoon3.ts index d822506..d4247fd 100644 --- a/src/discord/titles/nintendo/splatoon3.ts +++ b/src/discord/titles/nintendo/splatoon3.ts @@ -137,13 +137,13 @@ export default class SplatNet3Monitor extends EmbeddedLoop { // Identify the user by their icon as the vote list doesn't have friend IDs let fest_team = this.cached_voting_status?.data.fest?.teams - .find(t => t.votes.nodes.find(f => f.userIcon.url === friend?.userIcon.url)); + .find(t => t.votes?.nodes.find(f => f.userIcon.url === friend?.userIcon.url)); - if (this.fest && friend && (!this.cached_voting_status || (friend?.vsMode?.mode === 'FEST' && !fest_team))) { + if (this.fest && friend && (!this.cached_voting_status || (friend.vsMode?.mode === 'FEST' && !fest_team))) { this.cached_voting_status = await this.splatnet?.getFestVotingStatus(this.fest.id) ?? null; fest_team = this.cached_voting_status?.data.fest?.teams - .find(t => t.votes.nodes.find(f => f.userIcon.url === friend?.userIcon.url)); + .find(t => t.votes?.nodes.find(f => f.userIcon.url === friend?.userIcon.url)); } this.fest_team_voting_status = fest_team ?? null;