Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
How would I automatically move someone back to a channel?

So, basically I have some code setup and I don't see the issue with the code. But basically what I want it to do is if the previous voice channel of the member that switched channels was "DO NOT DISTURB" it will move them back to the "DO NOT DISTURB" voice channel. What have I done wrong? I get 0 errors in console.

    client.on('voiceStateUpdate', async (oldState, newState) => {
        let newUserChannel = newState.channel;
        let oldUserChannel = oldState.channel;

       if(oldUserChannel.id === "894024223088050176") {
                    var dndChannel = oldState.guild.channels.cache.find(ch => ch.type === "voice" && ch.name === "DO NOT DISTURB")
                    newState.member.voice.setChannel(dndChannel)
                }
      });

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Double check if your channelid in the if condition is right and use

Guild.channels.fetch(channelId)

insted of Guild.channels.cache.find().

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!