VcNarrator: Show all voices, better defaults

This commit is contained in:
Vendicated 2023-01-25 21:08:45 +01:00
parent 49aacccc19
commit 0c030a3a27
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -41,12 +41,6 @@ const VoiceStateStore = findByPropsLazy("getVoiceStatesForChannel", "getCurrentC
// Filtering out events is not as simple as just dropping duplicates, as otherwise mute, unmute, mute would // Filtering out events is not as simple as just dropping duplicates, as otherwise mute, unmute, mute would
// not say the second mute, which would lead you to believe they're unmuted // not say the second mute, which would lead you to believe they're unmuted
function getEnglishVoices() {
const voices = speechSynthesis.getVoices();
const englishVoices = voices.filter(v => v.lang.startsWith("en"));
return !englishVoices.length ? voices : englishVoices;
}
function speak(text: string, settings: any = Settings.plugins.VcNarrator) { function speak(text: string, settings: any = Settings.plugins.VcNarrator) {
if (!text) return; if (!text) return;
@ -219,7 +213,7 @@ export default definePlugin({
voice: { voice: {
type: OptionType.SELECT, type: OptionType.SELECT,
description: "Narrator Voice", description: "Narrator Voice",
options: getEnglishVoices().map(v => ({ options: speechSynthesis.getVoices().map(v => ({
label: v.name, label: v.name,
value: v.voiceURI, value: v.voiceURI,
default: v.default default: v.default
@ -242,12 +236,12 @@ export default definePlugin({
joinMessage: { joinMessage: {
type: OptionType.STRING, type: OptionType.STRING,
description: "Join Message", description: "Join Message",
default: "{{USER}} joined {{CHANNEL}}" default: "{{USER}} joined"
}, },
leaveMessage: { leaveMessage: {
type: OptionType.STRING, type: OptionType.STRING,
description: "Leave Message", description: "Leave Message",
default: "{{USER}} left {{CHANNEL}}" default: "{{USER}} left"
}, },
moveMessage: { moveMessage: {
type: OptionType.STRING, type: OptionType.STRING,