mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Ensure track is properly resumed in an edge case (#4996)
This commit is contained in:
parent
42101275d5
commit
ea82119605
@ -64,7 +64,18 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
|||||||
_error_code = extra.get("code")
|
_error_code = extra.get("code")
|
||||||
if _error_code in [1000] or not guild:
|
if _error_code in [1000] or not guild:
|
||||||
if _error_code == 1000 and player.current is not None and player.is_playing:
|
if _error_code == 1000 and player.current is not None and player.is_playing:
|
||||||
await player.resume(player.current, start=player.position, replace=False)
|
await player.resume(player.current, start=player.position, replace=True)
|
||||||
|
by_remote = extra.get("byRemote", "")
|
||||||
|
reason = extra.get("reason", "No Specified Reason").strip()
|
||||||
|
ws_audio_log.info(
|
||||||
|
"WS EVENT - SIMPLE RESUME (Healthy Socket) | "
|
||||||
|
"Voice websocket closed event "
|
||||||
|
"Code: %d -- Remote: %s -- %s, %r",
|
||||||
|
extra.get("code"),
|
||||||
|
by_remote,
|
||||||
|
reason,
|
||||||
|
player,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
await self._ws_op_codes[guild_id].put((event_channel_id, _error_code))
|
await self._ws_op_codes[guild_id].put((event_channel_id, _error_code))
|
||||||
try:
|
try:
|
||||||
@ -499,7 +510,17 @@ class LavalinkEvents(MixinMeta, metaclass=CompositeMetaClass):
|
|||||||
else:
|
else:
|
||||||
if not player.paused and player.current:
|
if not player.paused and player.current:
|
||||||
player.store("resumes", player.fetch("resumes", 0) + 1)
|
player.store("resumes", player.fetch("resumes", 0) + 1)
|
||||||
await player.resume(player.current, start=player.position, replace=False)
|
await player.resume(player.current, start=player.position, replace=True)
|
||||||
|
ws_audio_log.info(
|
||||||
|
"WS EVENT - SIMPLE RESUME (Healthy Socket) | "
|
||||||
|
"Voice websocket closed event "
|
||||||
|
"Code: %d -- Remote: %s -- %s, %r",
|
||||||
|
code,
|
||||||
|
by_remote,
|
||||||
|
reason,
|
||||||
|
player,
|
||||||
|
)
|
||||||
|
else:
|
||||||
ws_audio_log.info(
|
ws_audio_log.info(
|
||||||
"WS EVENT - IGNORED (Healthy Socket) | "
|
"WS EVENT - IGNORED (Healthy Socket) | "
|
||||||
"Voice websocket closed event "
|
"Voice websocket closed event "
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user