Bot stops listening after 1 minute

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.
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Jiron
JironOP2y ago
[email protected], node v18.14.1 There's also no error or anything. The bot just doesnt work anymore once the voiceStateUpdate event is fired
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Jiron
JironOP2y ago
Thank you so much I didnt come across that issue yet.
Want results from more Discord servers?
Add your server