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

189
Views
No se puede detectar que el usuario abandona el canal discord.js

Conecté dos cuentas de bot de Discord a un script y quiero expulsar a un usuario cuando abandona un canal de voz, pero no funciona. código:

 const { Client, Intents, ClientUser } = require('discord.js'); const cli = require('nodemon/lib/cli'); const clients = [ new Client({ intents: [Intents.FLAGS.GUILDS] }), new Client({ intents: [Intents.FLAGS.GUILDS] }) ]; const Tokens = ["token1", "token2"] clients.forEach(function(client, index) { client.login(Tokens[index]) let clientcount = index + 1 client.on("ready", () => { client.user.setUsername("PartyChat Bot") client.user.setActivity(`PartyChat Bot #${clientcount}`) console.log(`PartyBot #${clientcount} is online`) }) }); clients.forEach(function(client, index) { client.on('voiceStateUpdate', (oldState, newState) => { let newUserChannel = newState.voiceChannel let oldUserChannel = oldState.voiceChannel if(oldUserChannel === undefined && newUserChannel !== undefined) { // User Joins a voice channel } else if(newUserChannel === null){ console.log("user left") newState.member.kick() } }) });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if(oldState.channel && !newState.channel){ // code block }

esto detecta si el usuario estaba en el canal y se fue sin unirse al nuevo canal.

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!