Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda