From 9e0b5898a54fdac6a4d5c5d102e7c20850191939 Mon Sep 17 00:00:00 2001 From: a squid <34890855+squi-ddy@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:43:56 +0800 Subject: [PATCH] check for uuid collisions --- bot/src/cogs/ms_auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/src/cogs/ms_auth.py b/bot/src/cogs/ms_auth.py index 32c97b2..1cd4e69 100644 --- a/bot/src/cogs/ms_auth.py +++ b/bot/src/cogs/ms_auth.py @@ -146,7 +146,8 @@ async def get_real_ms_auth_link(self, data) -> Optional[Union[str, Literal[False return self.auth_flows.get(state, (0, 0, {}))[2].get("auth_uri") def get_ms_auth_link(self, member_id: int) -> str: - state = uuid.uuid4().hex + while (state := uuid.uuid4().hex) in self.auth_flows: + pass auth_flow = self.application.initiate_auth_code_flow( scopes=["User.Read"],