main: add signal_timestamp_to_datetime()

This commit is contained in:
lemoer 2024-12-27 01:20:35 +01:00
parent 5a2ff14d35
commit 7ec74d859f

View File

@ -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())