Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Fix voice session destroyed after bot moved #333

Closed
wants to merge 2 commits into from

Conversation

ferrenza
Copy link

@ferrenza ferrenza commented Feb 4, 2025

When the bot moves channels, the player was being destroyed because the disconnect wait did not account for the brief period between disconnect and reconnect. This commit modifies _disconnected_wait to wait for the _reconnecting event and then verifies the current voice state via guild.me.voice.channel If a valid channel is detected, the connection is restored without calling _destroy() This prevents accidental player deletion during channel moves.

Description

This PR fixes an issue where the player was inadvertently destroyed when the bot moved from one voice channel to another. By waiting for _reconnecting and checking guild.me.voice.channel, we ensure that a valid reconnect occurs before deciding whether to destroy the player. This prevents the brief disconnect period from prematurely removing the player's session during channel moves.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
    • I have updated the changelog with a quick recap of my changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
  • I have read and agree to the Developer Certificate of Origin for this contribution

When the bot moves channels, the player was being destroyed because the disconnect wait did not account for
the brief period between disconnect and reconnect. This commit modifies `_disconnected_wait` to wait for the
_reconnecting event and then verifies the current voice state via `guild.me.voice.channel`. If a valid channel
is detected, the connection is restored without calling `_destroy()`. This prevents accidental player deletion
during channel moves.
When the bot moves channels, the player was being destroyed because the disconnect wait did not account for
the brief period between disconnect and reconnect. This commit modifies `_disconnected_wait` to wait for the
_reconnecting event and then verifies the current voice state via `guild.me.voice.channel` If a valid channel
is detected, the connection is restored without calling `_destroy()` This prevents accidental player deletion
during channel moves.
@ferrenza ferrenza changed the title Fix player destroyed after voice moved Fix voice session destroyed after bot moved Feb 6, 2025
@ferrenza ferrenza closed this Mar 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant