#Bot stops listening after 1 minute

8 messages · Page 1 of 1 (latest)

loud gate
#

I am currently working on a Discord bot which has the purpose of listening to what other people say. I got it to repeat whatever users say into their microphones through a receiver.
Since there is no speaking event anymore, that made things more difficult but thats not what I want to ask.
I realized that when the bot stops receiving inputs from the users and thus does not play audio anymore, after one minute it fires a "voiceStateUpdate" event on the bot. Logging both oldMember and newMember does not give me any more information, since they are both identical logs:

client.on('voiceStateUpdate', (oldMember, newMember) => {
console.log(oldMember, newMember);
// oldMember is the same as newMember when this happens
});

The thing that changes though, is that the bot does not listen to anything anymore.

logging: "connection.receiver.speaking.users" shows me, that it cannot display the users that are actually talking anymore, because the bot is most probably not listening to them anymore. I read an old bugreport where it would stop listening after 5 minutes. that was djs v12 though. They fixed it by playing a silent noise. Im not really sure how to do that, but I really dont want to be playing a silent sound every minute just because of that. What can be the reason of that? Is there some kind of setting that I have to add to "joinVoiceChannel"? RIght now it just looks like this:

client.on("messageCreate", (message) => {
if(message.author.id != "501819491764666386") return;
const voicechannel = message.member.voice.channel;
if(!voicechannel) return message.channel.send("Please join a vc");
joinVoiceChannel({
channelId: voicechannel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator,
selfDeaf: false
});
let connection = getVoiceConnection(message.guild.id);
(...)

Added the bot only for testing purposes so thats why I dont specifically check for some kind of prefix but rather just if I sent the message.

tame beacon
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

loud gate
#

There's also no error or anything. The bot just doesnt work anymore once the voiceStateUpdate event is fired

royal meadow
#

This is a known issue regarding UDP socket keepAlive packets are not being recognized by voice servers

#

Resulting in djs voice to drop the UDP connection on its own.

#

A temporary workaround is to disable keepAlive timer and you will be good