nikoszz
nikoszz

Reputation: 173

Discord.js 12 How to make bot leave when there are no people in the Voice Channel?

I want to implement a check to see if there are no members in the voice channel the bot is in, so it can automatically disconnect and not stay there till I disconnect it or someone else does.

I had been searching around for any example, but found no relevant answers to my questions.

Anyone that can help?

Upvotes: 0

Views: 1234

Answers (1)

Fyxren
Fyxren

Reputation: 380

I suggest using the voiceStateUpdate event. In the event, check if there are members in the voicechannel. If not, then make the bot leave.

VoiceStateUpdate - Docs

Check if user is in an specific voice Channel - Stackoverflow

Upvotes: 1

Related Questions