From 76c933bde16b2f46f935b22ba132e8a622d96a57 Mon Sep 17 00:00:00 2001 From: a Date: Mon, 13 May 2024 05:23:32 +0000 Subject: [PATCH] Fix: Try to load opus if it wasn't automatically loaded This is necessary for musl-based systems like Alpine because ctypes.util.find_library('opus') will not find anything -- see https://bugs.python.org/issue21622 for more info --- cogs/music.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cogs/music.py b/cogs/music.py index d4b8aac..24c2140 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -528,6 +528,11 @@ class Music(Cog): # Ensure we are connected to voice if not ctx.voice_client: logger.warning("no voice client") + if not discord.opus.is_loaded(): + try: + discord.opus.load_opus("/usr/lib/libopus.so") + except: + logger.error("opus could not be loaded!") if ctx.author.voice: logger.info(f"moving voice client to {ctx.author.voice.channel}") await ctx.author.voice.channel.connect()