Fix discord RPC bugs

This commit is contained in:
Natsumi
2021-10-09 02:21:48 +13:00
parent 45fbb34672
commit 8b505a87f1

View File

@@ -7962,7 +7962,11 @@ speechSynthesis.getVoices();
};
$app.methods.updateDiscord = function () {
if (!this.discordActive || !this.isGameRunning) {
if (
!this.discordActive ||
!this.isGameRunning ||
(!this.lastLocation.location && !this.lastLocation$.tag)
) {
return;
}
var L = this.lastLocation$;
@@ -7975,6 +7979,7 @@ speechSynthesis.getVoices();
L.worldName = '';
L.worldCapacity = 0;
L.joinUrl = '';
L.accessName = '';
if (L.worldId) {
var ref = API.cachedWorlds.get(L.worldId);
if (ref) {
@@ -7992,19 +7997,19 @@ speechSynthesis.getVoices();
switch (L.accessType) {
case 'public':
L.joinUrl = getLaunchURL(L.worldId, L.instanceId);
L.accessType = `Public #${L.instanceName}`;
L.accessName = `Public #${L.instanceName}`;
break;
case 'invite+':
L.accessType = `Invite+ #${L.instanceName}`;
L.accessName = `Invite+ #${L.instanceName}`;
break;
case 'invite':
L.accessType = `Invite #${L.instanceName}`;
L.accessName = `Invite #${L.instanceName}`;
break;
case 'friends':
L.accessType = `Friends #${L.instanceName}`;
L.accessName = `Friends #${L.instanceName}`;
break;
case 'friends+':
L.accessType = `Friends+ #${L.instanceName}`;
L.accessName = `Friends+ #${L.instanceName}`;
break;
}
}
@@ -8012,8 +8017,8 @@ speechSynthesis.getVoices();
}
var hidePrivate = false;
if (
(this.discordHideInvite && L.accessType === 'Invite') ||
L.accessType === 'Invite+'
this.discordHideInvite &&
(L.accessType === 'invite' || L.accessType === 'invite+')
) {
hidePrivate = true;
}
@@ -8103,7 +8108,7 @@ speechSynthesis.getVoices();
Discord.SetText('Private', '');
Discord.SetTimestamps(0, 0);
} else if (this.discordInstance) {
Discord.SetText(L.worldName, L.accessType);
Discord.SetText(L.worldName, L.accessName);
} else {
Discord.SetText(L.worldName, '');
}