aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorthegamecracks <[email protected]>2021-06-28 00:00:17 -0400
committerGitHub <[email protected]>2021-06-28 00:00:17 -0400
commit6ce1c537d41602ee101e8745aefee00715504dae (patch)
tree81789e5d11c18945984cf20148149688dc50cae8 /discord
parentMake on_ready examples consistent (diff)
downloaddiscord.py-6ce1c537d41602ee101e8745aefee00715504dae.tar.xz
discord.py-6ce1c537d41602ee101e8745aefee00715504dae.zip
Localize Embed.timestamp during assignment
Diffstat (limited to 'discord')
-rw-r--r--discord/embeds.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/discord/embeds.py b/discord/embeds.py
index 47f4b07a..f57943f7 100644
--- a/discord/embeds.py
+++ b/discord/embeds.py
@@ -202,8 +202,6 @@ class Embed:
self.url = str(self.url)
if timestamp:
- if timestamp.tzinfo is None:
- timestamp = timestamp.astimezone()
self.timestamp = timestamp
@classmethod
@@ -327,7 +325,11 @@ class Embed:
@timestamp.setter
def timestamp(self, value: MaybeEmpty[datetime.datetime]):
- if isinstance(value, (datetime.datetime, _EmptyEmbed)):
+ if isinstance(value, datetime.datetime):
+ if value.tzinfo is None:
+ value = value.astimezone()
+ self._timestamp = value
+ elif isinstance(value, _EmptyEmbed):
self._timestamp = value
else:
raise TypeError(f"Expected datetime.datetime or Embed.Empty received {value.__class__.__name__} instead")