Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "botDisconnect" event is not emitted #972

Closed
loloToster opened this issue Jan 3, 2022 · 8 comments · Fixed by #1210
Closed

The "botDisconnect" event is not emitted #972

loloToster opened this issue Jan 3, 2022 · 8 comments · Fixed by #1210
Labels
bug Something isn't working

Comments

@loloToster
Copy link

Describe the bug
The "botDisconnect" event is not emitted

Info:

  • Node Version: v17.3.0
  • Discord Player Version: 5.2.0
  • Discord.js Version: 13.4.0

Additional context
I think I know why it is happening. The "botDisconnect" event is emitted in _handleVoiceState method of Player Class after

if (oldState.member.id === this.client.user.id && !newState.channelId)

statement that checks if the client has disconnected. For "botDisconnect" to get emitted the newState.channelId has to be false. But at the beggining of the method we can see this statement

if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId)

that checks if newState.channelId is true. So the "botDisconnect" event cannot be emitted because newState.channelId cannot be both true and false.
That's what I think is happening. Maybe I'm missing something?

@loloToster loloToster added the bug Something isn't working label Jan 3, 2022
@JusteLoneWolf
Copy link

I have the same issue
description

@JusteLoneWolf
Copy link

image
Additionnal thing made two console.log before and after the if statement and there are never pass

1 : When the bot arrive
2: when the bot is disconnected manually

@JusteLoneWolf
Copy link

JusteLoneWolf commented Jan 3, 2022

I managed to make a hotfix but there are still some adjustments to make

JusteLoneWolf added a commit to JusteLoneWolf/discord-player that referenced this issue Jan 3, 2022
it's an hot fox for this issue Androz2091#972
@pauldb09
Copy link

pauldb09 commented Jan 3, 2022

Known issue

@Alvin-Yu628
Copy link

It works now

@JusteLoneWolf
Copy link

With the hot fix yes but also no

@Alvin-Yu628
Copy link

Yep, just found that out now lmao

@EwoX07
Copy link
Contributor

EwoX07 commented Jan 12, 2022

#986

@twlite twlite linked a pull request Mar 28, 2022 that will close this issue
@twlite twlite linked a pull request Jul 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants