diff options
| author | Riley Shaw <[email protected]> | 2020-05-02 22:30:11 +0100 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-02 19:57:48 -0400 |
| commit | 75d3c4f6cfa87dbe48058310f945bb81b2994227 (patch) | |
| tree | deef1f7777399fc6cff9da1198cafab08ef5fdb9 | |
| parent | Add versionadded to Attachment.to_file use_cached param (diff) | |
| download | discord.py-75d3c4f6cfa87dbe48058310f945bb81b2994227.tar.xz discord.py-75d3c4f6cfa87dbe48058310f945bb81b2994227.zip | |
allow passing EmptyEmbed to set_image and set_thumbnail
| -rw-r--r-- | discord/embeds.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/discord/embeds.py b/discord/embeds.py index 8eefbb77..75c53da1 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -276,15 +276,21 @@ class Embed: This function returns the class instance to allow for fluent-style chaining. + .. versionchanged:: 1.4 + Passing :attr:`Empty` removes the image. + Parameters ----------- url: :class:`str` The source URL for the image. Only HTTP(S) is supported. """ - self._image = { - 'url': str(url) - } + if url is EmptyEmbed: + del self._image + else: + self._image = { + 'url': str(url) + } return self @@ -309,15 +315,21 @@ class Embed: This function returns the class instance to allow for fluent-style chaining. + .. versionchanged:: 1.4 + Passing :attr:`Empty` removes the thumbnail. + Parameters ----------- url: :class:`str` The source URL for the thumbnail. Only HTTP(S) is supported. """ - self._thumbnail = { - 'url': str(url) - } + if url is EmptyEmbed: + del self._thumbnail + else: + self._thumbnail = { + 'url': str(url) + } return self |