refactor(utils): remove opus load warning

This commit is contained in:
Ryan 2025-01-09 16:47:14 -05:00
parent 8cbd7d6aef
commit 23c29e1fa0
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -1,6 +1,6 @@
import os import os
import time import time
from logging import error, info, warning from logging import error, info
import disnake import disnake
@ -129,13 +129,14 @@ def filter_secrets(text: str, secrets=constants.SECRETS) -> str:
def load_opus(): def load_opus():
warning("opus wasn't automatically loaded! trying to load manually...") for path in filter(
for path in ["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"]: lambda p: os.path.exists(p),
if os.path.exists(path): ["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"],
try: ):
disnake.opus.load_opus(path) try:
info(f"successfully loaded opus from {path}") disnake.opus.load_opus(path)
return info(f"successfully loaded opus from {path}")
except Exception as e: return
error(f"failed to load opus from {path}: {e}") except Exception as e:
error(f"failed to load opus from {path}: {e}")
raise Exception("could not locate working opus library") raise Exception("could not locate working opus library")