Ran `ruff check --select F401 --fix` to auto-remove 221 unused imports, manually removed 4 unused `import discord` from package __init__.py files, and fixed test import for DISAPPOINTMENT_TIERS to reference canonical location. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
"""
|
|
Transaction command package for Discord Bot v2.0
|
|
|
|
Contains transaction management commands for league operations.
|
|
"""
|
|
|
|
import logging
|
|
from typing import List, Tuple, Type
|
|
|
|
from discord.ext import commands
|
|
|
|
from .management import TransactionCommands
|
|
from .dropadd import DropAddCommands
|
|
from .trade import TradeCommands
|
|
from .ilmove import ILMoveCommands
|
|
|
|
logger = logging.getLogger(f"{__name__}.setup_transactions")
|
|
|
|
|
|
async def setup_transactions(bot: commands.Bot) -> Tuple[int, int, List[str]]:
|
|
"""
|
|
Set up transaction command modules.
|
|
|
|
Returns:
|
|
Tuple of (successful_loads, failed_loads, failed_modules)
|
|
"""
|
|
transaction_cogs: List[Tuple[str, Type[commands.Cog]]] = [
|
|
("TransactionCommands", TransactionCommands),
|
|
("DropAddCommands", DropAddCommands),
|
|
("TradeCommands", TradeCommands),
|
|
("ILMoveCommands", ILMoveCommands),
|
|
]
|
|
|
|
successful = 0
|
|
failed = 0
|
|
failed_modules = []
|
|
|
|
for cog_name, cog_class in transaction_cogs:
|
|
try:
|
|
await bot.add_cog(cog_class(bot))
|
|
logger.info(f"✅ Loaded transaction command module: {cog_name}")
|
|
successful += 1
|
|
except Exception as e:
|
|
logger.error(
|
|
f"❌ Failed to load transaction command module {cog_name}: {e}"
|
|
)
|
|
failed += 1
|
|
failed_modules.append(cog_name)
|
|
|
|
# Log summary
|
|
if failed == 0:
|
|
logger.info(
|
|
f"🎉 All {successful} transaction command modules loaded successfully"
|
|
)
|
|
else:
|
|
logger.warning(
|
|
f"⚠️ Transaction commands loaded with issues: {successful} successful, {failed} failed"
|
|
)
|
|
if failed_modules:
|
|
logger.warning(f"Failed modules: {', '.join(failed_modules)}")
|
|
|
|
return successful, failed, failed_modules
|