allow passing EmptyEmbed to set_image and set_thumbnail

This commit is contained in:
Riley Shaw 2020-05-02 22:30:11 +01:00 committed by Rapptz
parent c424d82f74
commit 75d3c4f6cf

View File

@ -276,15 +276,21 @@ class Embed:
This function returns the class instance to allow for fluent-style This function returns the class instance to allow for fluent-style
chaining. chaining.
.. versionchanged:: 1.4
Passing :attr:`Empty` removes the image.
Parameters Parameters
----------- -----------
url: :class:`str` url: :class:`str`
The source URL for the image. Only HTTP(S) is supported. The source URL for the image. Only HTTP(S) is supported.
""" """
self._image = { if url is EmptyEmbed:
'url': str(url) del self._image
} else:
self._image = {
'url': str(url)
}
return self return self
@ -309,15 +315,21 @@ class Embed:
This function returns the class instance to allow for fluent-style This function returns the class instance to allow for fluent-style
chaining. chaining.
.. versionchanged:: 1.4
Passing :attr:`Empty` removes the thumbnail.
Parameters Parameters
----------- -----------
url: :class:`str` url: :class:`str`
The source URL for the thumbnail. Only HTTP(S) is supported. The source URL for the thumbnail. Only HTTP(S) is supported.
""" """
self._thumbnail = { if url is EmptyEmbed:
'url': str(url) del self._thumbnail
} else:
self._thumbnail = {
'url': str(url)
}
return self return self