Update utils.py
This commit is contained in:
parent
5133a58d6d
commit
5963ec05ca
@ -1034,19 +1034,21 @@ def format_dt(dt: datetime.datetime, /, style: Optional[TimestampStyle] = None)
|
|||||||
|
|
||||||
|
|
||||||
def generate_snowflake(dt: datetime.datetime) -> int:
|
def generate_snowflake(dt: datetime.datetime) -> int:
|
||||||
"""
|
##"""
|
||||||
-----------
|
#-----------
|
||||||
dt: :class:`datetime.datetime`
|
#dt: :class:`datetime.datetime`
|
||||||
A datetime object to convert to a snowflake.
|
#A datetime object to convert to a snowflake.
|
||||||
If naive, the timezone is assumed to be local time.
|
#If naive, the timezone is assumed to be local time.
|
||||||
Returns :class:`int` as The snowflake representing the time given.
|
#Returns :class:`int` as The snowflake representing the time given.
|
||||||
"""
|
#"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
|
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
|
||||||
|
|
||||||
|
|
||||||
def quick_snowflake() -> int:
|
def quick_snowflake() -> int:
|
||||||
""":class:`int` Returns with The snowflake representing a snowflake from the immediate time.
|
#""":class:`int` Returns with The snowflake representing a snowflake from the immediate time.
|
||||||
"""
|
#"""
|
||||||
|
|
||||||
return int(utcnow().timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
|
return int(utcnow().timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user