should work with utils.

This commit is contained in:
JDJG Inc. Official 2021-10-04 22:07:49 -04:00
parent 343d533640
commit 2bd28a7990

View File

@ -1034,6 +1034,7 @@ def format_dt(dt: datetime.datetime, /, style: Optional[TimestampStyle] = None)
def generate_snowflake(dt: Optional[datetime.datetime] = None) -> int:
"""Returns a numeric snowflake pretending to be created at the given date but more accurate and random than time_snowflake.
If No dt is not passed, it makes one from the current time using utcnow.
Parameters
-----------
@ -1046,17 +1047,6 @@ def generate_snowflake(dt: Optional[datetime.datetime] = None) -> int:
:class:`int`
The snowflake representing the time given.
"""
dt = dt or utcnow()
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
def quick_snowflake() -> int:
"""A helper function to return a snowflake from the current UTC time with some randomness to make it more unique.
Returns
--------
:class:`int`
The snowflake generated from the current time using utcnow.
"""
return int(utcnow().timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff