mirror of https://gitlab.com/litecord/litecord.git
snowflake: remove unused get_invite_code
blueprints.invites uses its own gen_inv_code() function, that is reasonably faster than the original.
This commit is contained in:
parent
d20626e716
commit
55dbe4f5a2
|
|
@ -41,14 +41,6 @@ WORKER_ID = 1
|
||||||
Snowflake = int
|
Snowflake = int
|
||||||
|
|
||||||
|
|
||||||
def get_invite_code() -> str:
|
|
||||||
"""Get a random invite code."""
|
|
||||||
random_stuff = hashlib.sha512(os.urandom(1024)).digest()
|
|
||||||
code = base64.urlsafe_b64encode(random_stuff).decode().replace('=', '5') \
|
|
||||||
.replace('_', 'W').replace('-', 'm')
|
|
||||||
return code[:6]
|
|
||||||
|
|
||||||
|
|
||||||
def _snowflake(timestamp: int) -> Snowflake:
|
def _snowflake(timestamp: int) -> Snowflake:
|
||||||
"""Get a snowflake from a specific timestamp
|
"""Get a snowflake from a specific timestamp
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue