Compare commits
2 Commits
0966c78521
...
f2fa623f4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2fa623f4e | ||
|
|
2e5f54a0f5 |
@@ -172,6 +172,12 @@ async def get_status(websocket, request_id):
|
|||||||
client_status['discord_status'] = DiscordStatusValues.INVOICE
|
client_status['discord_status'] = DiscordStatusValues.INVOICE
|
||||||
else:
|
else:
|
||||||
client_status['discord_status'] = DiscordStatusValues.ONLINE
|
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
|
# Return the status object
|
||||||
response_payload = {"status": client_status}
|
response_payload = {"status": client_status}
|
||||||
@@ -254,6 +260,14 @@ async def receive_commands(websocket):
|
|||||||
async def main_client():
|
async def main_client():
|
||||||
"""Connects to the server and handles communication with a robust retry system."""
|
"""Connects to the server and handles communication with a robust retry system."""
|
||||||
retry_delay = 5 # seconds
|
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:
|
while True:
|
||||||
print(f"Client {CLIENT_ID} attempting to connect to {SERVER_WS_URI}...")
|
print(f"Client {CLIENT_ID} attempting to connect to {SERVER_WS_URI}...")
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user