Fix discord RPC bugs

This commit is contained in:
Natsumi
2021-10-09 02:21:48 +13:00
parent 45fbb34672
commit 8b505a87f1
+14 -9
View File
@@ -7962,7 +7962,11 @@ speechSynthesis.getVoices();
}; };
$app.methods.updateDiscord = function () { $app.methods.updateDiscord = function () {
if (!this.discordActive || !this.isGameRunning) { if (
!this.discordActive ||
!this.isGameRunning ||
(!this.lastLocation.location && !this.lastLocation$.tag)
) {
return; return;
} }
var L = this.lastLocation$; var L = this.lastLocation$;
@@ -7975,6 +7979,7 @@ speechSynthesis.getVoices();
L.worldName = ''; L.worldName = '';
L.worldCapacity = 0; L.worldCapacity = 0;
L.joinUrl = ''; L.joinUrl = '';
L.accessName = '';
if (L.worldId) { if (L.worldId) {
var ref = API.cachedWorlds.get(L.worldId); var ref = API.cachedWorlds.get(L.worldId);
if (ref) { if (ref) {
@@ -7992,19 +7997,19 @@ speechSynthesis.getVoices();
switch (L.accessType) { switch (L.accessType) {
case 'public': case 'public':
L.joinUrl = getLaunchURL(L.worldId, L.instanceId); L.joinUrl = getLaunchURL(L.worldId, L.instanceId);
L.accessType = `Public #${L.instanceName}`; L.accessName = `Public #${L.instanceName}`;
break; break;
case 'invite+': case 'invite+':
L.accessType = `Invite+ #${L.instanceName}`; L.accessName = `Invite+ #${L.instanceName}`;
break; break;
case 'invite': case 'invite':
L.accessType = `Invite #${L.instanceName}`; L.accessName = `Invite #${L.instanceName}`;
break; break;
case 'friends': case 'friends':
L.accessType = `Friends #${L.instanceName}`; L.accessName = `Friends #${L.instanceName}`;
break; break;
case 'friends+': case 'friends+':
L.accessType = `Friends+ #${L.instanceName}`; L.accessName = `Friends+ #${L.instanceName}`;
break; break;
} }
} }
@@ -8012,8 +8017,8 @@ speechSynthesis.getVoices();
} }
var hidePrivate = false; var hidePrivate = false;
if ( if (
(this.discordHideInvite && L.accessType === 'Invite') || this.discordHideInvite &&
L.accessType === 'Invite+' (L.accessType === 'invite' || L.accessType === 'invite+')
) { ) {
hidePrivate = true; hidePrivate = true;
} }
@@ -8103,7 +8108,7 @@ speechSynthesis.getVoices();
Discord.SetText('Private', ''); Discord.SetText('Private', '');
Discord.SetTimestamps(0, 0); Discord.SetTimestamps(0, 0);
} else if (this.discordInstance) { } else if (this.discordInstance) {
Discord.SetText(L.worldName, L.accessType); Discord.SetText(L.worldName, L.accessName);
} else { } else {
Discord.SetText(L.worldName, ''); Discord.SetText(L.worldName, '');
} }