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

133
Views
Discord.JS Join To Create Temp VC to Delete

I want when a user is joining this temp channel to rename the channel as his Name#0000 - Discord_ID and when leaving from this temp vc to get deleted. How it can be done?

client.on('voiceStateUpdate', (oldState, newState) => {
    if (newState.channelID === 'channelID') { // You can also use `newState.channelID`
        newState.guild.channels.create("Tester", {
            type: 'voice',
            parent: 'categoryID'
        }).then(vc => {
            newState.setChannel(vc);
        })
    }
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

heres the code to make it name the channel with the member name, and delete it after leaving, i edited your code a bit

    client.on('voiceStateUpdate', (oldState, newState) => {
        if (newState.channel?.name === 'Replace with channel name') { // You can also use `newState.channelID`
            newState.guild.channels.create(`${newState.member.user.username}#${newState.member.user.discriminator}`, {
                type: 'GUILD_VOICE',
                parent: 'Replace with category id',
            }).then(vc => {
                newState.setChannel(vc);
            })
            }
            if (oldState.channel?.name === `${oldState.member.user.username}#${oldState.member.user.discriminator}`) {
                oldState.channel?.delete()

        }
    });




Just make sure to put the channel name, and the category id!


Also, those "?" in the codes are for typescript, if you're using JavaScript, then you won't need them.

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!