Compare commits

...

2 Commits

Author SHA1 Message Date
Logan Cusano
f2fa623f4e Update the active token when a status update is requested 2025-06-29 02:52:02 -04:00
Logan Cusano
2e5f54a0f5 Check discord status for token on startup 2025-06-29 02:48:29 -04:00

View File

@@ -172,6 +172,12 @@ async def get_status(websocket, request_id):
client_status['discord_status'] = DiscordStatusValues.INVOICE
else:
client_status['discord_status'] = DiscordStatusValues.ONLINE
# Check if the active token was passed and update the global
if "active_token" in discord_status and discord_status['active_token']:
# Update the bot token
global bot_token
bot_token = discord_status['active_token']
# Return the status object
response_payload = {"status": client_status}
@@ -254,6 +260,14 @@ async def receive_commands(websocket):
async def main_client():
"""Connects to the server and handles communication with a robust retry system."""
retry_delay = 5 # seconds
# Get initial status from the discord bot
discord_status = await drb_api.get_bot_status()
if "active_token" in discord_status and discord_status['active_token']:
# If there's a status and the active token is set, update the global var
global bot_token
bot_token = discord_status['active_token']
while True:
print(f"Client {CLIENT_ID} attempting to connect to {SERVER_WS_URI}...")
try: