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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -366,7 +366,8 @@
"when_to_play_game_closed": "Game Closed", "when_to_play_game_closed": "Game Closed",
"when_to_play_game_running": "Game Running", "when_to_play_game_running": "Game Running",
"when_to_play_always": "Always", "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] span {{ getTTSVoiceName() }} #[i.el-icon-arrow-down.el-icon--right]
el-dropdown-menu(#default="dropdown") 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") 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 //- Wrist Overlay Tab
el-tab-pane(:label="$t('view.settings.category.wrist_overlay')") el-tab-pane(:label="$t('view.settings.category.wrist_overlay')")
//- Wrist Overlay | SteamVR Wrist Overlay //- Wrist Overlay | SteamVR Wrist Overlay