diff --git a/main.py b/main.py index 0edf28a..f2ce860 100644 --- a/main.py +++ b/main.py @@ -17,6 +17,9 @@ class Config(BaseModel): apiurl: str number: str +def signal_timestamp_to_datetime(timestamp: str) -> datetime.datetime: + return datetime.datetime.fromtimestamp(int(timestamp)/1000) + class SignalAPI: def __init__(self, apiurl, number): @@ -256,7 +259,7 @@ class LabCleaningBot: res = self.api.send_message(message) if is_ok(res): - timestamp = datetime.datetime.fromtimestamp(int(res.unwrap().timestamp)/1000) + timestamp = signal_timestamp_to_datetime(res.unwrap().timestamp) request.requested_at = timestamp else: print(res.unwrap_err())