Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda