Update object.py

This commit is contained in:
JDJG Inc. Official 2021-10-03 22:42:54 -04:00 committed by GitHub
parent 4277f65051
commit 9e4c0f1065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,3 +94,18 @@ class Object(Hashable):
def created_at(self) -> datetime.datetime:
""":class:`datetime.datetime`: Returns the snowflake's creation time in UTC."""
return utils.snowflake_time(self.id)
@property
def worker_id(self) -> int:
""":class:`int`: Returns the worker id that made the snowflake."""
return (self.id & 0x3E0000) >> 17
@property
def process_id(self) -> int:
""":class:`int`: Returns the process id that made the snowflake."""
return (self.id & 0x1F000) >> 12
@property
def increment_id(self) -> int:
""":class:`int`: Returns the increment id that made the snowflake."""
return (self.id & 0xFFF)