Open yuntongzhang opened 1 month ago
@code-rover-bot
diff --git a/discord/voice_client.py b/discord/voice_client.py
index 3e1c6a5f..c3bf01a3 100644
--- a/discord/voice_client.py
+++ b/discord/voice_client.py
@@ -493,7 +493,13 @@ class VoiceClient(VoiceProtocol):
signal_type=signal_type,
)
- self._player = AudioPlayer(source, self, after=after)
+ def wrapped_after(error: Optional[Exception]) -> None:
+ if error:
+ _log.error('FFMPEG error: %s', error)
+ if after:
+ after(error)
+
+ self._player = AudioPlayer(source, self, after=wrapped_after)
self._player.start()
def is_playing(self) -> bool:
test action
test action
test action
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
GitHub Action is working!
test
GitHub Action is working!
test
test
test
test
test
test
test
test
@code-rover-bot
Running ACR GitHub Action for yuntongzhang__test-5. ACR code dir is /home/runner/work/_actions/AutoCodeRoverSG/code-rover-bot/v0.0.2/acr, target repo path is $GITHUB_WORKSPACE.
@code-rover-bot
Running ACR GitHub Action for yuntongzhang__test-5. ACR code dir is /home/runner/work/_actions/AutoCodeRoverSG/code-rover-bot/v0.0.2/acr, target repo path is .
test
test
test
test
t
t
@code-rover-bot
Running ACR GitHub Action for yuntongzhang__test-5. ACR code dir is /home/runner/work/_actions/AutoCodeRoverSG/code-rover-bot/v0.0.2/acr, target repo path is $GITHUB_WORKSPACE.
@code-rover-bot
Running ACR GitHub Action for yuntongzhang__test-5. ACR code dir is /home/runner/work/_actions/AutoCodeRoverSG/code-rover-bot/v0.0.2/acr, target repo path is ${GITHUB_WORKSPACE}.
@code-rover-bot
Running ACR GitHub Action for yuntongzhang__test-5. ACR code dir is /home/runner/work/_actions/AutoCodeRoverSG/code-rover-bot/v0.0.2/acr, target repo path is /home/runner/work/test/test.
@code-rover-bot
Summary
VoiceClient.play() doesn't pass FFMPEG error to 'after' function.
Reproduction Steps
I know from https://github.com/Rapptz/discord.py/issues/5131 that the session invalidation error is not a Discord.py error, however, the VoiceClient's play() function does not seem to be capturing and passing the FFMPEG error into my provided after function. I would like to notify when this error happens, so capturing this error would be very helpful. It also appears that Discord.py wrongly states that FFMPEG exited successfully, even when it exits with code 1, which by definition, is not successful.
Here is my current code and log results: Code:
Logs:
Minimal Reproducible Code
No response
Expected Results
I expected the FFMPEG error to be passed to the after function
Actual Results
The error was not captured and passed to the after function
Intents
discord.Intents.default()
System Information
Python v3.10.12-final discord.py v2.3.2-final aiohttp v3.9.5 system info: Linux 5.15.0-112-generic https://github.com/Rapptz/discord.py/pull/122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024
Checklist
Additional Context
No response