Skip to content

Commit

Permalink
add random element to hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Apr 16, 2024
1 parent e0ceb7d commit 6db8a9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gamewide/war/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import asyncio
import coc
import pendulum as pend
import random

from hashids import Hashids
from datetime import datetime
Expand Down Expand Up @@ -232,7 +233,8 @@ async def get_war(clan_tag : str):
if war_result.get("data") is not None:
return

custom_id = hashids.encode(int(war.preparation_start_time.time.replace(tzinfo=pend.UTC).timestamp()) + int(pend.now(tz=pend.UTC).timestamp()))

custom_id = hashids.encode(int(war.preparation_start_time.time.replace(tzinfo=pend.UTC).timestamp()) + int(pend.now(tz=pend.UTC).timestamp()) + random.randint(1000000000, 9999999999))
await db_client.clan_wars.update_one({"war_id": war_unique_id},
{"$set" : {
"custom_id": custom_id,
Expand Down

0 comments on commit 6db8a9d

Please sign in to comment.