Skip to content

Commit

Permalink
chrome config
Browse files Browse the repository at this point in the history
  • Loading branch information
PAW122 committed Dec 15, 2024
1 parent 5bb5013 commit 96b1ec8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion commands/normal/live_caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 96b1ec8

Please sign in to comment.