skg
skg
DIAdiscord.js - Imagine an app
Created by skg on 8/20/2024 in #djs-voice
Bot wont talk & no error, how do i debug?
(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);
});

}
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);
});

}
41 replies
DIAdiscord.js - Imagine an app
Created by skg on 8/20/2024 in #djs-questions
Bot wont talk & no error, how do i debug? (.wav sound file)
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);
});

}
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);
});

}
6 replies