This commit is contained in:
JDJG Inc. Official 2021-10-03 22:55:43 -04:00
parent dea01b189b
commit 675e3250e2

View File

@ -1034,17 +1034,19 @@ def format_dt(dt: datetime.datetime, /, style: Optional[TimestampStyle] = None)
def generate_snowflake(dt: datetime.datetime) -> int:
##"""
#-----------
#dt: :class:`datetime.datetime`
#A datetime object to convert to a snowflake.
#If naive, the timezone is assumed to be local time.
#Returns :class:`int` as The snowflake representing the time given.
#"""
"""Returns a numeric snowflake pretending to be created at the given date but more accurate and random than snowflake_time.
Parameters
-----------
dt: :class:`datetime.datetime`
A datetime object to convert to a snowflake.
If naive, the timezone is assumed to be local time.
Returns
--------
:class:`int`
The snowflake representing the time given.
"""
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff