(selected opus tag bc i had to, to post idk what it is)
how do i debug this? since it says nothing in logs and doesnt even light up green
code (voiceConnectionAudioPlayer.player.play(...) is actually ran):
function sayAsUser(text, userId)
{
const voice = voicesJSON();
const name = getRandomInt(1000).toString() + ".wav";
const filePath = `D:/js projects/schizophrenia discord bot/sounds/${name}`;
// say.speak(text, voice.userVoices.voice[voice.userVoices.userId.indexOf(userId)]);
say.export(text, voice.userVoices.voice[voice.userVoices.userId.indexOf(userId)], 1, filePath, (e) => {
console.log(e);
});
console.log("trying to play audio...");
const watcher = fs.watch("D:/js projects/schizophrenia discord bot/sounds", (eventType, file) => {
if(eventType == "rename" && file == name)
{
console.log("actually playing audio...");
voiceConnectionAudioPlayer.player.play(createAudioResource(fs.createReadStream(filePath)));
watcher.close();
}
console.log(file);
});
}