Fix Discord RPC 3

This commit is contained in:
Natsumi
2022-08-27 18:45:55 +12:00
parent bfaefd3694
commit 938f86d1ff
2 changed files with 24 additions and 10 deletions

View File

@@ -4140,6 +4140,7 @@ speechSynthesis.getVoices();
ipcTimeout: 0,
nextClearVRCXCacheCheck: 0,
nextDiscordUpdate: 0,
isDiscordActive: false,
isGameRunning: false,
isGameNoVR: configRepository.getBool('isGameNoVR'),
isSteamVRRunning: false,
@@ -4281,7 +4282,9 @@ speechSynthesis.getVoices();
}
if (--this.nextDiscordUpdate <= 0) {
this.nextDiscordUpdate = 7;
this.updateDiscord();
if (this.discordActive) {
this.updateDiscord();
}
}
}
);
@@ -7882,6 +7885,7 @@ speechSynthesis.getVoices();
configRepository.setBool('discordHideInvite', this.discordHideInvite);
configRepository.setBool('discordHideImage', this.discordHideImage);
this.lastLocation$.tag = '';
this.nextDiscordUpdate = 7;
this.updateDiscord();
};
@@ -10002,9 +10006,10 @@ speechSynthesis.getVoices();
!this.isGameRunning ||
(!currentLocation && !this.lastLocation$.tag)
) {
Discord.SetInactive();
this.setDiscordActive(false);
return;
}
this.setDiscordActive(true);
var L = this.lastLocation$;
if (currentLocation !== this.lastLocation$.tag) {
Discord.SetTimestamps(timeStamp, 0);
@@ -10172,6 +10177,12 @@ speechSynthesis.getVoices();
}
};
$app.methods.setDiscordActive = async function (active) {
if (active !== this.isDiscordActive) {
this.isDiscordActive = await Discord.SetActive(active);
}
};
$app.methods.lookupUser = async function (ref) {
if (ref.userId) {
this.showUserDialog(ref.userId);