Skip to content

Commit

Permalink
make tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Snipy7374 committed Aug 26, 2024
1 parent 59dd700 commit b5bc743
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions disnake/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def set_footer(
"text": str(text),
}

result = self._handle_resource(icon_url, file, key="footer")
result = self._handle_resource(icon_url, file, key="footer", strict=False)
if result is not None:
self._footer["icon_url"] = result

Expand Down Expand Up @@ -649,7 +649,9 @@ def set_author(
if url is not None:
self._author["url"] = str(url)

result = self._handle_resource(icon_url, file, key="author")
result = self._handle_resource(
icon_url if icon_url else None, file, key="author", strict=False
)
if result is not None:
self._author["icon_url"] = result

Expand Down Expand Up @@ -884,9 +886,15 @@ def get_default_colour(cls) -> Optional[Colour]:

get_default_color = get_default_colour

def _handle_resource(self, url: Optional[Any], file: File, *, key: _FileKey) -> Optional[str]:
if not (url is MISSING) ^ (file is MISSING):
raise TypeError("Exactly one of url or file must be provided")
def _handle_resource(
self, url: Optional[Any], file: File, *, key: _FileKey, strict: bool = True
) -> Optional[str]:
if strict:
if not (url is MISSING) ^ (file is MISSING):
raise TypeError("Exactly one of url or file must be provided")
else:
if url is not MISSING and file is not MISSING:
raise TypeError("Only one of url or file must be provided, not both.")

if file:
if file.filename is None:
Expand Down

0 comments on commit b5bc743

Please sign in to comment.