aboutsummaryrefslogtreecommitdiff
path: root/discord/embeds.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-04 23:54:08 -0400
committerRapptz <[email protected]>2021-04-04 23:54:08 -0400
commitff7094ce9602bad0b4408761841fa02bdb908987 (patch)
treed0d37067183f6827398181e598133146f870fa26 /discord/embeds.py
parentRemove some lingering userbot classes in the documentation (diff)
downloaddiscord.py-ff7094ce9602bad0b4408761841fa02bdb908987.tar.xz
discord.py-ff7094ce9602bad0b4408761841fa02bdb908987.zip
Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout the library.
Diffstat (limited to 'discord/embeds.py')
-rw-r--r--discord/embeds.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/embeds.py b/discord/embeds.py
index 91d2a6d3..59278c97 100644
--- a/discord/embeds.py
+++ b/discord/embeds.py
@@ -87,7 +87,9 @@ class Embed:
The URL of the embed.
This can be set during initialisation.
timestamp: :class:`datetime.datetime`
- The timestamp of the embed content. This could be a naive or aware datetime.
+ The timestamp of the embed content. This is an aware datetime.
+ If a naive datetime is passed, it is converted to an aware
+ datetime with the local timezone.
colour: Union[:class:`Colour`, :class:`int`]
The colour code of the embed. Aliased to ``color`` as well.
This can be set during initialisation.
@@ -129,6 +131,8 @@ class Embed:
except KeyError:
pass
else:
+ if timestamp.tzinfo is None:
+ timestamp = timestamp.astimezone()
self.timestamp = timestamp
@classmethod