From 96b1ec81df28dc63cdd44a939f3c34aa169fe970 Mon Sep 17 00:00:00 2001 From: PAW122 <70094237+PAW122@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:21:07 +0100 Subject: [PATCH] chrome config --- commands/normal/live_caption.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/normal/live_caption.js b/commands/normal/live_caption.js index 05785e3..e184b35 100644 --- a/commands/normal/live_caption.js +++ b/commands/normal/live_caption.js @@ -2,6 +2,9 @@ const { SlashCommandBuilder } = require("discord.js"); const { joinVoiceChannel, VoiceConnectionStatus } = require('@discordjs/voice'); const puppeteer = require('puppeteer'); +const config = require("../../config.json") +const config_data = config[config.using].chrome_path + const command = new SlashCommandBuilder() .setName("live_caption") .setDescription("Translate what users on VC say to text for deaf people") @@ -64,6 +67,7 @@ async function startCaptioning(connection, interaction, discordClient, language) // Launch Puppeteer with Chromium console.log("lunch puppeteer") const browser = await puppeteer.launch({ + executablePath: config_data, headless: false, // Run in headless mode args: ["--use-fake-ui-for-media-stream", '--no-sandbox', '--disable-setuid-sandbox'] // Automatically allow microphone }).catch(err => { @@ -99,7 +103,7 @@ async function startCaptioning(connection, interaction, discordClient, language) let finalTranscript = ''; for (let i = event.resultIndex; i < event.results.length; i++) { if (event.results[i].isFinal) { - finalTranscript += event.results[i][0].transcript + '\\n'; + finalTranscript += event.results[i][0].transcript + '\\\\n'; } } window.transcriptCallback(finalTranscript);