diff --git a/app/internal/types.py b/app/internal/types.py index a1d7346..2dc464d 100644 --- a/app/internal/types.py +++ b/app/internal/types.py @@ -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 diff --git a/app/routers/bot.py b/app/routers/bot.py index 8e5d78a..84bc3c7 100644 --- a/app/routers/bot.py +++ b/app/routers/bot.py @@ -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