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
This commit is contained in:
a 2024-05-13 05:23:32 +00:00
parent 92766b83ff
commit 76c933bde1

View file

@ -528,6 +528,11 @@ class Music(Cog):
# Ensure we are connected to voice # Ensure we are connected to voice
if not ctx.voice_client: if not ctx.voice_client:
logger.warning("no 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: if ctx.author.voice:
logger.info(f"moving voice client to {ctx.author.voice.channel}") logger.info(f"moving voice client to {ctx.author.voice.channel}")
await ctx.author.voice.channel.connect() await ctx.author.voice.channel.connect()