Handles EmptyEmbed inside setter instead of set_

This commit is contained in:
Ahmad Ansori Palembani
2021-09-02 08:54:44 +07:00
committed by GitHub
parent 2367d9d7e2
commit 31f8813665

View File

@@ -405,6 +405,9 @@ class Embed:
@image.setter
def image(self: E, url: Any):
if url is EmptyEmbed:
del self._image
else:
self._image = {
'url': str(url),
}
@@ -431,9 +434,6 @@ class Embed:
The source URL for the image. Only HTTP(S) is supported.
"""
if url is EmptyEmbed:
del self.image
else:
self.image = url
return self
@@ -458,6 +458,9 @@ class Embed:
"""Sets the thumbnail for the embed content.
"""
if url is EmptyEmbed:
del self._thumbnail
else:
self._thumbnail = {
'url': str(url),
}
@@ -485,9 +488,7 @@ 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
return self