Fix bug when checking if token is in use and added the token to the active clients when selected

This commit is contained in:
Logan Cusano
2025-05-24 18:27:09 -04:00
parent 8bb8a60ece
commit 69b02b363e
2 changed files with 5 additions and 4 deletions

View File

@@ -6,9 +6,9 @@ class ActiveClient:
The active client model in memory for quicker access
"""
websocket = None
active_token: str = None
active_token: DiscordId = None
def __init__(self, websocket= None, active_token:str=None):
def __init__(self, websocket= None, active_token:DiscordId=None):
self.active_token = active_token
self.websocket = websocket

View File

@@ -46,6 +46,7 @@ async def request_token_route():
# --- Logic for selecting a preferred ID based on client_id (TODO) ---
selected_id = avail_ids[0]
current_app.active_clients[client_id].active_token = selected_id
# --- End of logic for selecting a preferred ID ---
@@ -67,8 +68,8 @@ def find_token_in_active_clients(target_token: str) -> bool:
Returns:
True if the token is found in any ActiveClient, False otherwise.
"""
for client in current_app.active_clients:
if client.active_token == target_token:
for client_id in current_app.active_clients:
if current_app.active_clients[client_id].active_token == target_token:
return True
return False