OmegaDevStudio / Selfcord-Old

A discord selfbot API wrapper.
MIT License
38 stars 18 forks source link

Message: store the received JSON data; get actual message's timestamp #77

Closed hatarist closed 11 months ago

hatarist commented 11 months ago

There's a lot of fields in the actual JSON that aren't accessible from the Message object instance. I decided to keep it in the _data variable.

Regarding the message timestamp:
Not sure if there's a need to use time.time(), but I kept it in case there would be no timestamp in the data.
Feel free to remove it by keeping it just like that:

self.timestamp = datetime.datetime.strptime(data.get('timestamp'), '%Y-%m-%dT%H:%M:%S.%f%z').timestamp()

Though it will crash if there will be no timestamp key.