modified: Dockerfile

modified:   app.py
This commit is contained in:
SimolZimol
2025-10-28 16:08:02 +01:00
parent 56c3b769cb
commit a493d4eaf5
2 changed files with 5 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ WORKDIR /app
RUN apt-get update && apt-get install -y \
libffi-dev \
libnacl-dev \
libopus0 \
ffmpeg \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

5
app.py
View File

@@ -1435,14 +1435,15 @@ class GuildMusic:
audio = discord.FFmpegPCMAudio(stream_url, before_options=FFMPEG_BEFORE_OPTS, options=FFMPEG_OPTS)
source = discord.PCMVolumeTransformer(audio, volume=self.volume)
done_evt = asyncio.Event()
loop = asyncio.get_running_loop()
def after_play(err):
try:
if err:
logging.warning(f"Player error: {err}")
finally:
# Signal to loop that track ended
asyncio.run_coroutine_threadsafe(done_evt.set(), asyncio.get_event_loop())
# Signal to loop that track ended from voice thread
loop.call_soon_threadsafe(done_evt.set)
self.voice.play(source, after=after_play)