FIx: More robust opus loading code

This commit is contained in:
a 2024-05-13 05:36:25 +00:00
parent eade77ffc3
commit 8ba7906e9f

View file

@ -451,11 +451,16 @@ class Music(Cog):
logger.info("playing Player on the voice client")
self.h += [self.track]
if not discord.opus.is_loaded():
try:
discord.opus.load_opus("/usr/lib/libopus.so")
except:
logger.error("opus could not be loaded!")
while not discord.opus.is_loaded():
for path in [
"/usr/lib/libopus.so",
"/usr/lib/libopus.so.0",
]:
try:
discord.opus.load_opus(path)
except:
logger.warning(f"opus could not be loaded from {path} -- trying next?")
logger.error("opus could not be loaded!")
ctx.voice_client.play(
player,
after=lambda e: self.after(ctx)