fix(utils/discord): properly find .so for libopus

This commit is contained in:
2025-12-14 15:50:10 -05:00
parent 69f5af19ae
commit 8ed9d05a67

View File

@@ -1,5 +1,6 @@
import ctypes
import time
from logging import error, info
from logging import debug, error
from pathlib import Path
import disnake
@@ -63,13 +64,10 @@ async def channel_send(message, *args, **kwargs):
def load_opus():
for path in filter(
lambda p: Path(p).exists(),
["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"],
):
path = ctypes.util._findLib_ld("opus")
try:
disnake.opus.load_opus(path)
info(f"successfully loaded opus from {path}")
debug(f"successfully loaded opus from {path}")
return
except Exception as e:
error(f"failed to load opus from {path}: {e}")