From efb6e3c1d2f93ee67a55236e253387ad49a90709 Mon Sep 17 00:00:00 2001 From: Mifuyu Date: Tue, 29 Jul 2025 04:52:20 +0700 Subject: [PATCH] fix: don't create Asset with empty hash in User.banner The `banner` field in the Discord API `User` object is both nullable and can be missing. When a User is fetched with `force=True` to obtain the `banner` value, due to how the data is processed, an Asset with hash=None may be erroneously created, whose url points to `None.png`. This fix makes User correctly process the null `banner` such that User.banner would become `None` in that case, rather than `Asset(hash=None)`. The similar Member object processed `banner` correctly and is not affected by this bug. --- interactions/models/discord/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interactions/models/discord/user.py b/interactions/models/discord/user.py index 1b2b02933..be6d88a28 100644 --- a/interactions/models/discord/user.py +++ b/interactions/models/discord/user.py @@ -171,7 +171,7 @@ def _process_dict(cls, data: Dict[str, Any], client: "Client") -> Dict[str, Any] if any(field in data for field in ("banner", "accent_color", "avatar_decoration")): data["_fetched"] = True - if "banner" in data: + if data.get("banner", None): data["banner"] = Asset.from_path_hash(client, f"banners/{data['id']}/{{}}", data["banner"]) if data.get("premium_type", None) is None: