diff --git a/admission.py b/admission.py index 250843b..1e4c5b3 100644 --- a/admission.py +++ b/admission.py @@ -26,8 +26,15 @@ def webhook_online(stream) -> None: data = {"username": f"{config.WEBHOOK_NAME} Online", "content": config.WEBHOOK_ONLINE} if config.is_avatar_ready(): - target_av = f"{stream[1]}/{stream[2]}.png".lower() - avatar = target_av if Path(config.WEBHOOK_AVATAR_PATH, target_av).is_file() else "default.png" + target_av = f"{stream[1]}/{stream[2]}.png" + + # Try an exact match first, then lower case, then use the default + if Path(config.WEBHOOK_AVATAR_PATH, target_av).is_file(): + avatar = target_av + elif Path(config.WEBHOOK_AVATAR_PATH, target_av.lower()).is_file(): + avatar = target_av.lower() + else: + avatar = "default.png" data["avatar_url"] = f"{config.WEBHOOK_AVATAR_URL}/{avatar}" requests.post(config.WEBHOOK_URL, timeout=10, json=data, headers=config.WEBHOOK_HEADERS)