From 64736070e9950f70021d09ed7c49c32ea11c430e Mon Sep 17 00:00:00 2001 From: Izhar Ahmad <54180221+nerdguyahmad@users.noreply.github.com> Date: Sun, 5 Sep 2021 19:34:51 +0500 Subject: [PATCH] Add `remove_image` and `remove_thumbnail` methods. --- discord/embeds.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/discord/embeds.py b/discord/embeds.py index 7033a10e78..c1d528cd5a 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -424,6 +424,22 @@ def set_image(self: E, *, url: MaybeEmpty[Any]) -> E: return self + def remove_image(self): + """Removes the embed's image. + + This function returns the class instance to allow for fluent-style + chaining. + + .. versionadded:: 2.0 + """ + try: + del self._image + except AttributeError: + pass + + return self + + @property def thumbnail(self) -> _EmbedMediaProxy: """Returns an ``EmbedProxy`` denoting the thumbnail contents. @@ -466,6 +482,21 @@ def set_thumbnail(self: E, *, url: MaybeEmpty[Any]) -> E: return self + def remove_thumbnail(self): + """Removes the embed's thumbnail. + + This function returns the class instance to allow for fluent-style + chaining. + + .. versionadded:: 2.0 + """ + try: + del self._thumbnail + except AttributeError: + pass + + return self + @property def video(self) -> _EmbedVideoProxy: """Returns an ``EmbedProxy`` denoting the video contents.