diff --git a/config.py b/config.py index 726c416..1013ee2 100644 --- a/config.py +++ b/config.py @@ -14,3 +14,7 @@ DISCORD_TOKEN = "MTQ0Mjg3NjU3NTUzMDg3NzAxMQ.GH7MGP.VdYH4QXmPL-9Zi9zhp-Ot6SmiCxWQ POLL_INTERVAL = 30 HIT_CHECK_INTERVAL = 60 REASSIGN_DELAY = 120 + +# Bot Assignment Settings +ASSIGNMENT_TIMEOUT = 60 # Seconds before reassigning a target +ASSIGNMENT_REMINDER = 30 # Seconds before sending reminder message diff --git a/services/__pycache__/bot_assignment.cpython-311.pyc b/services/__pycache__/bot_assignment.cpython-311.pyc index 2825f99..b4d6753 100644 Binary files a/services/__pycache__/bot_assignment.cpython-311.pyc and b/services/__pycache__/bot_assignment.cpython-311.pyc differ diff --git a/services/bot_assignment.py b/services/bot_assignment.py index f1a58e7..a8d4782 100644 --- a/services/bot_assignment.py +++ b/services/bot_assignment.py @@ -5,6 +5,7 @@ from pathlib import Path from typing import Dict, Optional from datetime import datetime from services.server_state import STATE +from config import ASSIGNMENT_TIMEOUT, ASSIGNMENT_REMINDER class BotAssignmentManager: def __init__(self, bot): @@ -40,13 +41,13 @@ class BotAssignmentManager: async def start(self): """Start the bot assignment loop""" if self.running: - print("⚠ Bot assignment already running") + print("WARNING: Bot assignment already running") return self.running = True self.task = asyncio.create_task(self.assignment_loop()) - print("✓ Bot assignment loop started") - print(f"✓ Loaded {len(self.discord_mapping)} Discord ID mappings") + print("Bot assignment loop started") + print(f"Loaded {len(self.discord_mapping)} Discord ID mappings") async def stop(self): """Stop the bot assignment loop""" @@ -199,7 +200,7 @@ class BotAssignmentManager: # Send Discord message enemy_link = f"https://www.torn.com/profiles.php?XID={enemy_id}" - message = f"**New target for {discord_user.mention}!**\n\nAttack **{enemy.name}** (Level {enemy.level})\n{enemy_link}\n\n⏰ You have 60 seconds!" + message = f"**New target for {discord_user.mention}!**\n\nAttack **{enemy.name}** (Level {enemy.level})\n{enemy_link}\n\nYou have {ASSIGNMENT_TIMEOUT} seconds!" try: await discord_user.send(message) @@ -225,24 +226,25 @@ class BotAssignmentManager: if friendly_id in STATE.friendly: # Increment hit count STATE.friendly[friendly_id].hits += 1 - print(f"✓ {STATE.friendly[friendly_id].name} successfully hospitalized {enemy.name}") + print(f"SUCCESS: {STATE.friendly[friendly_id].name} successfully hospitalized {enemy.name}") # Remove from active targets del self.active_targets[key] continue - # Send reminder at 15 seconds - if elapsed >= 15 and not data["reminded"]: + # Send reminder + if elapsed >= ASSIGNMENT_REMINDER and not data["reminded"]: discord_id = data["discord_id"] try: discord_user = await self.bot.fetch_user(discord_id) - await discord_user.send(f"⏰ **Reminder:** Target {enemy.name} - 15 seconds left!") + remaining = ASSIGNMENT_TIMEOUT - ASSIGNMENT_REMINDER + await discord_user.send(f"**Reminder:** Target {enemy.name} - {remaining} seconds left!") data["reminded"] = True except: pass - # Reassign after 60 seconds - if elapsed >= 60: + # Reassign after timeout + if elapsed >= ASSIGNMENT_TIMEOUT: to_reassign.append((data["group_id"], enemy_id)) del self.active_targets[key]