file not found error

This commit is contained in:
churl
2022-01-20 23:29:08 +01:00
parent dbf611fddd
commit b4d354ace3

5
bot.py
View File

@ -224,11 +224,12 @@ class HeidiClient(discord.Client):
soundfile = message.content.split(" ")[-1]
try:
audio_source = discord.FFmpegPCMAudio("/sounds/" + soundfile + ".mp3") # only works from docker
except AttributeError:
open("/sounds/" + soundfile + ".mp3")
except IOError:
print("Error: Invalid soundfile!")
return
audio_source = discord.FFmpegPCMAudio("/sounds/" + soundfile + ".mp3") # only works from docker
voice_client = await voice_channel.connect()
voice_client.play(audio_source)