From 23c29e1fa0d6dff78dfbc3b236058975bc634439 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Thu, 9 Jan 2025 16:47:14 -0500 Subject: [PATCH] refactor(utils): remove opus load warning --- utils.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/utils.py b/utils.py index b022c28..dc98779 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ import os import time -from logging import error, info, warning +from logging import error, info import disnake @@ -129,13 +129,14 @@ def filter_secrets(text: str, secrets=constants.SECRETS) -> str: def load_opus(): - warning("opus wasn't automatically loaded! trying to load manually...") - for path in ["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"]: - if os.path.exists(path): - try: - disnake.opus.load_opus(path) - info(f"successfully loaded opus from {path}") - return - except Exception as e: - error(f"failed to load opus from {path}: {e}") + for path in filter( + lambda p: os.path.exists(p), + ["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"], + ): + try: + disnake.opus.load_opus(path) + info(f"successfully loaded opus from {path}") + return + except Exception as e: + error(f"failed to load opus from {path}: {e}") raise Exception("could not locate working opus library")