Create leveling.view.ts with UI logic extracted from leaderboard command:
- getLeaderboardEmbed() for leaderboard display (XP and Balance)
- getMedalEmoji() helper for ranking medals (🥇🥈🥉)
- formatLeaderEntry() helper for entry formatting with null safety
Updated leaderboard.ts to use view functions instead of inline formatting.
Create quest.view.ts with UI logic extracted from quests command:
- getQuestListEmbed() for quest log display
- formatQuestRewards() helper for reward formatting
- getQuestStatus() helper for status display
Updated quests.ts to use view functions instead of inline embed building.
Create inventory.view.ts with UI logic extracted from commands:
- getInventoryEmbed() for inventory display
- getItemUseResultEmbed() for item use results
Updated commands with proper type safety:
- inventory.ts: add null check, convert user.id to string
- use.ts: add null check, convert user.id to string
Improves separation of concerns and type safety.
Convert from class-based to object-based export for consistency with
other services (economy, inventory, quest, etc).
Changes:
- Move sessions Map and helper functions to module scope
- Convert static methods to object properties
- Update executeTrade to use withTransaction helper
- Update all imports from TradeService to tradeService
Updated files:
- trade.service.ts (main refactor)
- trade.interaction.ts (update usages)
- trade.ts command (update import and usage)
All tests passing with no breaking changes.
Replace manual transaction handling with withTransaction helper pattern
for consistency with other services (economy, inventory, quest, leveling).
Also fix validation bug in modifyClassBalance:
- Before: if (balance < amount)
- After: if (balance + amount < 0n)
This correctly validates negative amounts (debits) to prevent balances
going below zero.
Update loaders, handlers, and BotClient to use centralized logger:
- CommandLoader.ts and EventLoader.ts
- AutocompleteHandler.ts, CommandHandler.ts, ComponentInteractionHandler.ts
- BotClient.ts
Provides consistent formatting across all core library logging.