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