From 52b6497fc354ac476c52ea2ed1b0f9bd3d7d375d Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Fri, 10 Jun 2022 07:50:19 +0200 Subject: [PATCH] Use static_format over format if present in Asset.replace --- discord/asset.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/asset.py b/discord/asset.py index b510f5d36..4f2aea807 100644 --- a/discord/asset.py +++ b/discord/asset.py @@ -382,6 +382,11 @@ class Asset(AssetMixin): ) -> Self: """Returns a new asset with the passed components replaced. + + .. versionchanged:: 2.0 + ``static_format`` is now preferred over ``format`` + if both are present and the asset is not animated. + .. versionchanged:: 2.0 This function will now raise :exc:`ValueError` instead of ``InvalidArgument``. @@ -415,7 +420,7 @@ class Asset(AssetMixin): if format not in VALID_ASSET_FORMATS: raise ValueError(f'format must be one of {VALID_ASSET_FORMATS}') else: - if format not in VALID_STATIC_FORMATS: + if static_format is MISSING and format not in VALID_STATIC_FORMATS: raise ValueError(f'format must be one of {VALID_STATIC_FORMATS}') url = url.with_path(f'{path}.{format}')