From 2367d9d7e2d9fec871e34c5b0f3b88f717060974 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani <46041660+null2264@users.noreply.github.com> Date: Wed, 1 Sep 2021 19:08:29 +0700 Subject: [PATCH 1/3] Fixed `TypeError` --- discord/embeds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/embeds.py b/discord/embeds.py index 25f05aef..a877b5c8 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -404,7 +404,7 @@ class Embed: return EmbedProxy(getattr(self, '_image', {})) # type: ignore @image.setter - def image(self: E, *, url: Any): + def image(self: E, url: Any): self._image = { 'url': str(url), } @@ -454,7 +454,7 @@ class Embed: return EmbedProxy(getattr(self, '_thumbnail', {})) # type: ignore @thumbnail.setter - def thumbnail(self: E, *, url: Any): + def thumbnail(self: E, url: Any): """Sets the thumbnail for the embed content. """ -- 2.47.2 From 31f881366530bb0a7188ba9328105d5ec44696f5 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani <46041660+null2264@users.noreply.github.com> Date: Thu, 2 Sep 2021 08:54:44 +0700 Subject: [PATCH 2/3] Handles `EmptyEmbed` inside setter instead of set_ --- discord/embeds.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/discord/embeds.py b/discord/embeds.py index a877b5c8..51e70cd6 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -405,9 +405,12 @@ class Embed: @image.setter def image(self: E, url: Any): - self._image = { - 'url': str(url), - } + if url is EmptyEmbed: + del self._image + else: + self._image = { + 'url': str(url), + } @image.deleter def image(self: E): @@ -431,10 +434,7 @@ class Embed: The source URL for the image. Only HTTP(S) is supported. """ - if url is EmptyEmbed: - del self.image - else: - self.image = url + self.image = url return self @@ -458,9 +458,12 @@ class Embed: """Sets the thumbnail for the embed content. """ - self._thumbnail = { - 'url': str(url), - } + if url is EmptyEmbed: + del self._thumbnail + else: + self._thumbnail = { + 'url': str(url), + } return @@ -485,10 +488,8 @@ class Embed: url: :class:`str` The source URL for the thumbnail. Only HTTP(S) is supported. """ - if url is EmptyEmbed: - del self.thumbnail - else: - self.thumbnail = url + + self.thumbnail = url return self -- 2.47.2 From 09a75eb78eb08b86f654b6eaac7d2bed4a2d1f41 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani <46041660+null2264@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:25:18 +0700 Subject: [PATCH 3/3] Remove return and setter docstring --- discord/embeds.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/discord/embeds.py b/discord/embeds.py index 51e70cd6..41f2be40 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -455,9 +455,6 @@ class Embed: @thumbnail.setter def thumbnail(self: E, url: Any): - """Sets the thumbnail for the embed content. - """ - if url is EmptyEmbed: del self._thumbnail else: @@ -465,8 +462,6 @@ class Embed: 'url': str(url), } - return - @thumbnail.deleter def thumbnail(self): try: -- 2.47.2