fix voice

This commit is contained in:
churl
2022-01-20 00:03:04 +01:00
parent 9eb432dc54
commit 9ad9c78774
4 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# syntax=docker/dockerfile:1
FROM python:3.10.1-slim-buster
RUN apt-get update -y
RUN apt-get install -y ffmpeg libopus0
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

4
bot.py
View File

@ -219,8 +219,10 @@ class HeidiClient(discord.Client):
print("Error: Caller not in channel!")
return
soundfile = message.content.split(" ")[-1]
voice_client = await voice_channel.connect()
audio_source = discord.FFmpegPCMAudio("/sounds/" + message + ".mp3") # only works from docker
audio_source = discord.FFmpegPCMAudio("/sounds/" + soundfile + ".mp3") # only works from docker
voice_client.play(audio_source)
while voice_client.is_playing():