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") logger.info("playing Player on the voice client")
self.h += [self.track] self.h += [self.track]
if not discord.opus.is_loaded(): while not discord.opus.is_loaded():
try: for path in [
discord.opus.load_opus("/usr/lib/libopus.so") "/usr/lib/libopus.so",
except: "/usr/lib/libopus.so.0",
logger.error("opus could not be loaded!") ]:
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( ctx.voice_client.play(
player, player,
after=lambda e: self.after(ctx) after=lambda e: self.after(ctx)