Fix bug when checking if token is in use and added the token to the active clients when selected
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user