refactor: extract Discord.js code from shared services into bot layer

Move terminal.service.ts and prune.service.ts entirely to bot/modules/
since they are Discord-specific. Split lootdrop.service.ts: pure logic
(activity tracking, DB ops, claim) stays in shared/, Discord operations
(message sending, channel interactions) move to bot/modules/economy/
lootdrop.handler.ts. Move effect registry/handlers/types from bot/ to
shared/modules/inventory/ since they contain no Discord.js imports and
are needed by inventory.service.ts in shared.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-03-18 13:15:29 +01:00
parent 5a20ed23f4
commit abe25e0ceb
15 changed files with 175 additions and 137 deletions

View File

@@ -73,7 +73,7 @@ async function handler(ctx: RouteContext): Promise<Response | null> {
*/
if (pathname === "/api/lootdrops" && method === "POST") {
return withErrorHandling(async () => {
const { lootdropService } = await import("@shared/modules/economy/lootdrop.service");
const { spawnLootdrop } = await import("../../../bot/modules/economy/lootdrop.handler");
const { AuroraClient } = await import("../../../bot/lib/BotClient");
const { TextChannel } = await import("discord.js");
@@ -89,7 +89,7 @@ async function handler(ctx: RouteContext): Promise<Response | null> {
return errorResponse("Invalid channel. Must be a TextChannel.", 400);
}
await lootdropService.spawnLootdrop(channel, data.amount, data.currency);
await spawnLootdrop(channel, data.amount, data.currency);
return jsonResponse({ success: true }, 201);
}, "spawn lootdrop");
@@ -110,8 +110,8 @@ async function handler(ctx: RouteContext): Promise<Response | null> {
if (!messageId) return null;
return withErrorHandling(async () => {
const { lootdropService } = await import("@shared/modules/economy/lootdrop.service");
const success = await lootdropService.deleteLootdrop(messageId);
const { deleteLootdrop } = await import("../../../bot/modules/economy/lootdrop.handler");
const success = await deleteLootdrop(messageId);
if (!success) {
return errorResponse("Lootdrop not found", 404);