file and folder organization, removal of monoliths

This commit is contained in:
2025-11-25 14:34:32 -05:00
parent 93a5da75eb
commit f5fa1cd703
12 changed files with 188 additions and 301 deletions

54
cogs/commands.py Normal file
View File

@@ -0,0 +1,54 @@
from discord.ext import commands
from services.torn_api import fetch_enemy_members
from services.ffscouter import fetch_batch_stats
class HitCommands(commands.Cog):
def __init__(self, bot, enrolled_attackers, enemy_queue):
self.bot = bot
self.enrolled_attackers = enrolled_attackers
self.enemy_queue = enemy_queue
@commands.command()
async def enroll(self, ctx):
user_id = ctx.author.id
if user_id in self.enrolled_attackers:
await ctx.send("You are already enrolled.")
return
self.enrolled_attackers.append(user_id)
await ctx.send(f"{ctx.author.mention} has been enrolled in the hit rotation!")
@commands.command()
async def drop(self, ctx):
user_id = ctx.author.id
if user_id not in self.enrolled_attackers:
await ctx.send("You are not enrolled.")
return
self.enrolled_attackers.remove(user_id)
await ctx.send(f"{ctx.author.mention} has been removed from the rotation.")
@commands.command()
async def stats(self, ctx):
members = await fetch_enemy_members()
if not members:
await ctx.send("No active members found.")
return
ids = [m["id"] for m in members if m.get("status", {}).get("state") in ("Okay", "Idle")]
ff_map = await fetch_batch_stats(ids)
lines = []
for m in members:
pid = str(m["id"])
est = ff_map.get(pid, {}).get("bs_estimate_human", "?")
if m.get("status", {}).get("state") not in ("Okay", "Idle"):
continue
lines.append(f"**{m['name']}** (ID:{pid}) | Lv {m['level']} | Estimated BS: {est}")
chunk = ""
for line in lines:
if len(chunk) + len(line) > 1900:
await ctx.send(chunk)
chunk = ""
chunk += line + "\n"
if chunk:
await ctx.send(chunk)