#Here s a snippet of what I do

1 messages · Page 1 of 1 (latest)

distant kindle
#

Sorry to ask dumb questions, just wanna get them outta the way:

  • Are you uber super positive that the joinVoiceChannel command is being called? ie, are you sure the if(lowerCaseMessage === 'join') branch is being followed?

  • Have you console.log()'d the id used in joinVoiceChannel, and the id used for when you call getVoiceConnection, to double triple check that they're the same ID?

  • Where are you calling getVoiceConnection? From within the lambda, right after joinVoiceChannel, or elsewhere outside of the messageCreate callback?

#

Also, have you tried doing const vc = joinVoiceChannel({...}) and seeing if the voiceConnection that joinVoiceChannel itself should be returning is valid?

raw oasis
#

Thanks for helping btw.

So I just found that it works if I call it from my index file, but it does not work when used in a specific node module file.

I want to use discord speech recognition but this line fails to get the voice connection instance. This issue might be out of the scope of the discordjs server, but it still does confuse me why I'm not able to get the instance in that file, even if I manually use the guild id in a setInterval

GitHub

Speech to text extension for discord.js. Contribute to Rei-x/discord-speech-recognition development by creating an account on GitHub.

distant kindle
#

if you haven't already, I'd still double check that the id you're using in the setInterval (the one where getVoiceConnection isn't working) is prim and proper for the sake of sanity

raw oasis
#

It is correct. Just really odd that the function works in my index file but not in the node modules file.

distant kindle
#

what is voice_1?

raw oasis
#

const voice_1 = require("@discordjs/voice");

#

It's in a node_modules file. I was debugging why the speech recognition package wasnt working. I narrowed it down to this issue. Didn't see any issues about this in the github page either

raw oasis
#

I actually got it. I removed "type": "module", from my package.json and used require instead of import syntax and now it works. So odd. Not sure what piece of software is at fault

distant kindle
#

Ah, that's a much better explanation than the conspiracy theories I was coming up with

I wonder if the node_modules package was using it's own, local copy of @discordjs/voice, and something was going screwy between that, and your top level @discordjs/voice