TTS memo nick name

This commit is contained in:
Natsumi
2024-11-20 13:32:01 +13:00
parent 299f2cce10
commit 89eb8cca8e
8 changed files with 64 additions and 37 deletions

View File

@@ -7795,6 +7795,10 @@ speechSynthesis.getVoices();
'VRCX_notificationTTS',
'Never'
);
$app.data.notificationTTSNickName = await configRepository.getBool(
'VRCX_notificationTTSNickName',
false
);
$app.data.notificationTTSVoice = await configRepository.getString(
'VRCX_notificationTTSVoice',
'0'
@@ -7980,6 +7984,10 @@ speechSynthesis.getVoices();
'VRCX_afkDesktopToast',
this.afkDesktopToast
);
await configRepository.setBool(
'VRCX_notificationTTSNickName',
this.notificationTTSNickName
);
await configRepository.setBool('VRCX_minimalFeed', this.minimalFeed);
await configRepository.setBool(
'displayVRCPlusIconsAsAvatar',

View File

@@ -1,5 +1,6 @@
import { baseClass, $app, API, $t, $utils } from './baseClass.js';
import configRepository from '../repository/config.js';
import database from '../repository/database.js';
export default class extends baseClass {
constructor(_app, _API, _t) {

View File

@@ -1,6 +1,7 @@
import * as workerTimers from 'worker-timers';
import gameLogService from '../service/gamelog.js';
import configRepository from '../repository/config.js';
import database from '../repository/database.js';
import { baseClass, $app, API, $t, $utils } from './baseClass.js';
export default class extends baseClass {

View File

@@ -1,5 +1,6 @@
import * as workerTimers from 'worker-timers';
import configRepository from '../repository/config.js';
import database from '../repository/database.js';
import { baseClass, $app, API, $t, $utils } from './baseClass.js';
export default class extends baseClass {

View File

@@ -1,4 +1,5 @@
import { baseClass, $app, API, $t, $utils } from './baseClass.js';
import database from '../repository/database.js';
export default class extends baseClass {
constructor(_app, _API, _t) {

View File

@@ -246,7 +246,7 @@ export default class extends baseClass {
}
}
if (playNotificationTTS) {
this.playNotyTTS(noty, message);
this.playNotyTTS(noty, displayName, message);
}
if (
playDesktopToast ||
@@ -309,8 +309,7 @@ export default class extends baseClass {
}
},
async notyGetImage(noty) {
var imageUrl = '';
getUserIdFromNoty(noty) {
var userId = '';
if (noty.userId) {
userId = noty.userId;
@@ -326,6 +325,13 @@ export default class extends baseClass {
}
}
}
return userId;
},
async notyGetImage(noty) {
var imageUrl = '';
var userId = this.getUserIdFromNoty(noty);
if (noty.thumbnailImageUrl) {
imageUrl = noty.thumbnailImageUrl;
} else if (noty.details && noty.details.imageUrl) {
@@ -397,20 +403,29 @@ export default class extends baseClass {
);
},
playNotyTTS(noty, message) {
async playNotyTTS(noty, displayName, message) {
if (this.notificationTTSNickName) {
var userId = this.getUserIdFromNoty(noty);
var memo = await $app.getUserMemo(userId);
if (memo.memo) {
var array = memo.memo.split('\n');
var nickName = array[0];
displayName = nickName;
}
}
switch (noty.type) {
case 'OnPlayerJoined':
this.speak(`${noty.displayName} has joined`);
this.speak(`${displayName} has joined`);
break;
case 'OnPlayerLeft':
this.speak(`${noty.displayName} has left`);
this.speak(`${displayName} has left`);
break;
case 'OnPlayerJoining':
this.speak(`${noty.displayName} is joining`);
this.speak(`${displayName} is joining`);
break;
case 'GPS':
this.speak(
`${noty.displayName} is in ${this.displayLocation(
`${displayName} is in ${this.displayLocation(
noty.location,
noty.worldName,
noty.groupName
@@ -426,22 +441,20 @@ export default class extends baseClass {
noty.groupName
)}`;
}
this.speak(
`${noty.displayName} has logged in${locationName}`
);
this.speak(`${displayName} has logged in${locationName}`);
break;
case 'Offline':
this.speak(`${noty.displayName} has logged out`);
this.speak(`${displayName} has logged out`);
break;
case 'Status':
this.speak(
`${noty.displayName} status is now ${noty.status} ${noty.statusDescription}`
`${displayName} status is now ${noty.status} ${noty.statusDescription}`
);
break;
case 'invite':
this.speak(
`${
noty.senderUsername
displayName
} has invited you to ${this.displayLocation(
noty.details.worldId,
noty.details.worldName,
@@ -451,33 +464,31 @@ export default class extends baseClass {
break;
case 'requestInvite':
this.speak(
`${noty.senderUsername} has requested an invite${message}`
`${displayName} has requested an invite${message}`
);
break;
case 'inviteResponse':
this.speak(
`${noty.senderUsername} has responded to your invite${message}`
`${displayName} has responded to your invite${message}`
);
break;
case 'requestInviteResponse':
this.speak(
`${noty.senderUsername} has responded to your invite request${message}`
`${displayName} has responded to your invite request${message}`
);
break;
case 'friendRequest':
this.speak(
`${noty.senderUsername} has sent you a friend request`
);
this.speak(`${displayName} has sent you a friend request`);
break;
case 'Friend':
this.speak(`${noty.displayName} is now your friend`);
this.speak(`${displayName} is now your friend`);
break;
case 'Unfriend':
this.speak(`${noty.displayName} is no longer your friend`);
this.speak(`${displayName} is no longer your friend`);
break;
case 'TrustLevel':
this.speak(
`${noty.displayName} trust level is now ${noty.trustLevel}`
`${displayName} trust level is now ${noty.trustLevel}`
);
break;
case 'DisplayName':
@@ -489,7 +500,7 @@ export default class extends baseClass {
this.speak(noty.message);
break;
case 'groupChange':
this.speak(`${noty.senderUsername} ${noty.message}`);
this.speak(`${displayName} ${noty.message}`);
break;
case 'group.announcement':
this.speak(noty.message);
@@ -513,10 +524,10 @@ export default class extends baseClass {
this.speak(noty.message);
break;
case 'PortalSpawn':
if (noty.displayName) {
if (displayName) {
this.speak(
`${
noty.displayName
displayName
} has spawned a portal to ${this.displayLocation(
noty.instanceId,
noty.worldName,
@@ -529,11 +540,11 @@ export default class extends baseClass {
break;
case 'AvatarChange':
this.speak(
`${noty.displayName} changed into avatar ${noty.name}`
`${displayName} changed into avatar ${noty.name}`
);
break;
case 'ChatBoxMessage':
this.speak(`${noty.displayName} said ${noty.text}`);
this.speak(`${displayName} said ${noty.text}`);
break;
case 'Event':
this.speak(noty.data);
@@ -545,28 +556,28 @@ export default class extends baseClass {
this.speak(`Now playing: ${noty.notyName}`);
break;
case 'BlockedOnPlayerJoined':
this.speak(`Blocked user ${noty.displayName} has joined`);
this.speak(`Blocked user ${displayName} has joined`);
break;
case 'BlockedOnPlayerLeft':
this.speak(`Blocked user ${noty.displayName} has left`);
this.speak(`Blocked user ${displayName} has left`);
break;
case 'MutedOnPlayerJoined':
this.speak(`Muted user ${noty.displayName} has joined`);
this.speak(`Muted user ${displayName} has joined`);
break;
case 'MutedOnPlayerLeft':
this.speak(`Muted user ${noty.displayName} has left`);
this.speak(`Muted user ${displayName} has left`);
break;
case 'Blocked':
this.speak(`${noty.displayName} has blocked you`);
this.speak(`${displayName} has blocked you`);
break;
case 'Unblocked':
this.speak(`${noty.displayName} has unblocked you`);
this.speak(`${displayName} has unblocked you`);
break;
case 'Muted':
this.speak(`${noty.displayName} has muted you`);
this.speak(`${displayName} has muted you`);
break;
case 'Unmuted':
this.speak(`${noty.displayName} has unmuted you`);
this.speak(`${displayName} has unmuted you`);
break;
}
},

View File

@@ -366,7 +366,8 @@
"when_to_play_game_closed": "Game Closed",
"when_to_play_game_running": "Game Running",
"when_to_play_always": "Always",
"tts_voice": "TTS Voice"
"tts_voice": "TTS Voice",
"use_memo_nicknames": "Use Memo Nicknames"
}
}
},

View File

@@ -355,6 +355,9 @@ mixin settingsTab()
span {{ getTTSVoiceName() }} #[i.el-icon-arrow-down.el-icon--right]
el-dropdown-menu(#default="dropdown")
el-dropdown-item(v-if="voice" v-for="(voice, index) in TTSvoices" :key="index" v-text="voice.name" :command="index")
div.options-container-item
span.name {{ $t('view.settings.notifications.notifications.text_to_speech.use_memo_nicknames') }}
el-switch(v-model="notificationTTSNickName" @change="saveOpenVROption" :disabled="notificationTTS === 'Never'")
//- Wrist Overlay Tab
el-tab-pane(:label="$t('view.settings.category.wrist_overlay')")
//- Wrist Overlay | SteamVR Wrist Overlay