Notify on block/muted users joining/leaving

This commit is contained in:
Natsumi
2021-05-21 23:31:50 +12:00
parent 09a4a823f8
commit 6de718e994
4 changed files with 169 additions and 5 deletions

View File

@@ -3698,6 +3698,9 @@ speechSynthesis.getVoices();
if (--this.nextFriendsRefresh <= 0) {
this.nextFriendsRefresh = 7200; // 1hour
API.refreshFriends();
if (this.isGameRunning) {
API.refreshPlayerModerations();
}
}
AppApi.CheckGameRunning().then(([isGameRunning, isGameNoVR]) => {
if (isGameRunning !== this.isGameRunning) {
@@ -3948,6 +3951,49 @@ speechSynthesis.getVoices();
}
}
}
if ((ctx.type === 'OnPlayerJoined') ||
(ctx.type === 'OnPlayerLeft')) {
for (var ref of this.playerModerationTable.data) {
if (ref.targetDisplayName === ctx.data) {
if (ref.type === 'block') {
var type = `Blocked${ctx.type}`;
} else if (ref.type === 'mute') {
var type = `Muted${ctx.type}`;
} else {
continue;
}
var displayName = ref.targetDisplayName;
var userId = ref.targetUserId;
var created_at = ctx.created_at;
if ((wristFilter[type]) &&
((wristFilter[type] === 'Everyone') ||
((wristFilter[type] === 'Friends') && (isFriend)) ||
((wristFilter[type] === 'VIP') && (isFavorite)))) {
wristArr.unshift({
created_at,
type,
displayName,
userId,
isFriend,
isFavorite
});
}
if ((notyFilter[type]) &&
((notyFilter[type] === 'Everyone') ||
((notyFilter[type] === 'Friends') && (isFriend)) ||
((notyFilter[type] === 'VIP') && (isFavorite)))) {
notyArr.unshift({
created_at,
type,
displayName,
userId,
isFriend,
isFavorite
});
}
}
}
}
if ((w < 20) && (wristFilter[ctx.type]) &&
((wristFilter[ctx.type] === 'On') ||
(wristFilter[ctx.type] === 'Everyone') ||
@@ -4288,7 +4334,7 @@ speechSynthesis.getVoices();
imageURL = noty.details.imageUrl;
} else if (userId) {
imageURL = await API.getCachedUser({
userId: userId
userId
}).catch((err) => {
console.error(err);
return false;
@@ -4387,6 +4433,18 @@ speechSynthesis.getVoices();
case 'VideoPlay':
this.speak(`Now playing: ${noty.data}`);
break;
case 'BlockedOnPlayerJoined':
this.speak(`Blocked user ${noty.displayName} has joined`);
break;
case 'BlockedOnPlayerLeft':
this.speak(`Blocked user ${noty.displayName} has left`);
break;
case 'MutedOnPlayerJoined':
this.speak(`Muted user ${noty.displayName} has joined`);
break;
case 'MutedOnPlayerLeft':
this.speak(`Muted user ${noty.displayName} has left`);
break;
default:
break;
}
@@ -4452,6 +4510,18 @@ speechSynthesis.getVoices();
case 'VideoPlay':
AppApi.XSNotification('VRCX', `Now playing: ${noty.data}`, timeout, image);
break;
case 'BlockedOnPlayerJoined':
AppApi.XSNotification('VRCX', `Blocked user ${noty.displayName} has joined`, timeout, image);
break;
case 'BlockedOnPlayerLeft':
AppApi.XSNotification('VRCX', `Blocked user ${noty.displayName} has left`, timeout, image);
break;
case 'MutedOnPlayerJoined':
AppApi.XSNotification('VRCX', `Muted user ${noty.displayName} has joined`, timeout, image);
break;
case 'MutedOnPlayerLeft':
AppApi.XSNotification('VRCX', `Muted user ${noty.displayName} has left`, timeout, image);
break;
default:
break;
}
@@ -4516,6 +4586,18 @@ speechSynthesis.getVoices();
case 'VideoPlay':
AppApi.DesktopNotification('Now playing', noty.data, image);
break;
case 'BlockedOnPlayerJoined':
AppApi.DesktopNotification(noty.displayName, 'blocked user has joined', image);
break;
case 'BlockedOnPlayerLeft':
AppApi.DesktopNotification(noty.displayName, 'blocked user has left', image);
break;
case 'MutedOnPlayerJoined':
AppApi.DesktopNotification(noty.displayName, 'muted user has joined', image);
break;
case 'MutedOnPlayerLeft':
AppApi.DesktopNotification(noty.displayName, 'muted user has left', image);
break;
default:
break;
}
@@ -7063,9 +7145,12 @@ speechSynthesis.getVoices();
DisplayName: 'VIP',
TrustLevel: 'VIP',
PortalSpawn: 'Everyone',
ItemDestroy: 'Off',
Event: 'On',
VideoPlay: 'On'
VideoPlay: 'On',
BlockedOnPlayerJoined: 'Off',
BlockedOnPlayerLeft: 'Off',
MutedOnPlayerJoined: 'Off',
MutedOnPlayerLeft: 'Off'
},
wrist: {
Location: 'On',
@@ -7086,9 +7171,12 @@ speechSynthesis.getVoices();
DisplayName: 'Friends',
TrustLevel: 'Friends',
PortalSpawn: 'Everyone',
ItemDestroy: 'Everyone',
Event: 'On',
VideoPlay: 'On'
VideoPlay: 'On',
BlockedOnPlayerJoined: 'Off',
BlockedOnPlayerLeft: 'Off',
MutedOnPlayerJoined: 'Off',
MutedOnPlayerLeft: 'Off'
}
};
configRepository.setString('sharedFeedFilters', JSON.stringify(sharedFeedFilters));