From 2e53963398b3cf7609c17430c88979af4c5cebc4 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 8 Sep 2019 13:03:46 +0200 Subject: [PATCH] Make LiveLocationAttachment.expires_at a datetime object Renamed from .expiration_time --- fbchat/_location.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fbchat/_location.py b/fbchat/_location.py index a3dc829..3a4f2af 100644 --- a/fbchat/_location.py +++ b/fbchat/_location.py @@ -59,14 +59,14 @@ class LiveLocationAttachment(LocationAttachment): #: Name of the location name = attr.ib(None) - #: Timestamp when live location expires - expiration_time = attr.ib(None) + #: Datetime when live location expires + expires_at = attr.ib(None) #: True if live location is expired is_expired = attr.ib(None) - def __init__(self, name=None, expiration_time=None, is_expired=None, **kwargs): + def __init__(self, name=None, expires_at=None, is_expired=None, **kwargs): super(LiveLocationAttachment, self).__init__(**kwargs) - self.expiration_time = expiration_time + self.expires_at = expires_at self.is_expired = is_expired @classmethod @@ -80,7 +80,7 @@ class LiveLocationAttachment(LocationAttachment): if not data.get("stopReason") else None, name=data.get("locationTitle"), - expiration_time=data["expirationTime"], + expires_at=_util.millis_to_datetime(data["expirationTime"]), is_expired=bool(data.get("stopReason")), ) @@ -96,7 +96,7 @@ class LiveLocationAttachment(LocationAttachment): if target.get("coordinate") else None, name=data["title_with_entities"]["text"], - expiration_time=target.get("expiration_time"), + expires_at=_util.millis_to_datetime(target.get("expiration_time")), is_expired=target.get("is_expired"), ) media = data.get("media")