File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1026,11 +1026,16 @@ class Embed(DictSerializerMixin):
10261026
10271027 def __init__ (self , ** kwargs ):
10281028 super ().__init__ (** kwargs )
1029- self .timestamp = (
1030- datetime .fromisoformat (self ._json .get ("timestamp" ))
1031- if self ._json .get ("timestamp" )
1032- else datetime .utcnow ()
1033- )
1029+ if self ._json .get ("timestamp" ):
1030+ if isinstance (self ._json .get ("timestamp" ), str ):
1031+ self .timestamp = datetime .fromisoformat (
1032+ self ._json .get ("timestamp" )
1033+ ) # readability on non `_json` attr.
1034+ elif isinstance (self ._json .get ("timestamp" ), datetime ):
1035+ self ._json ["timestamp" ] = str (
1036+ self ._json .get ("timestamp" )
1037+ ) # converts to isoformat for API.
1038+
10341039 self .footer = EmbedFooter (** self .footer ) if isinstance (self .footer , dict ) else self .footer
10351040 self .image = EmbedImageStruct (** self .image ) if isinstance (self .image , dict ) else self .image
10361041 self .thumbnail = (
@@ -1048,7 +1053,6 @@ def __init__(self, **kwargs):
10481053 if self ._json .get ("fields" )
10491054 else None
10501055 )
1051-
10521056 # (Complete partial fix.)
10531057 # The issue seems to be that this itself is not updating
10541058 # JSON result correctly. After numerous attempts I seem to
You can’t perform that action at this time.
0 commit comments