forked from syntaxbullet/AuroraBot-discord
refactor: clean up unused imports and dead code across commands, services, and tests.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createCommand } from "@lib/utils";
|
||||
import { AuroraClient } from "@/lib/BotClient";
|
||||
import { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, MessageFlags } from "discord.js";
|
||||
import { createErrorEmbed, createSuccessEmbed, createWarningEmbed } from "@lib/embeds";
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } from "discord.js";
|
||||
import { createErrorEmbed, createSuccessEmbed } from "@lib/embeds";
|
||||
|
||||
export const refresh = createCommand({
|
||||
data: new SlashCommandBuilder()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createCommand } from "@lib/utils";
|
||||
import { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, MessageFlags, ButtonBuilder, ButtonStyle, ActionRowBuilder, ComponentType } from "discord.js";
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags, ButtonBuilder, ButtonStyle, ActionRowBuilder, ComponentType } from "discord.js";
|
||||
import { createErrorEmbed, createSuccessEmbed, createWarningEmbed, createInfoEmbed } from "@lib/embeds";
|
||||
|
||||
export const update = createCommand({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createCommand } from "@/lib/utils";
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, TextChannel, NewsChannel, VoiceChannel, MessageFlags } from "discord.js";
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } from "discord.js";
|
||||
import { createErrorEmbed } from "@/lib/embeds";
|
||||
import { sendWebhookMessage } from "@/lib/webhookUtils";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export const balance = createCommand({
|
||||
const targetUser = interaction.options.getUser("user") || interaction.user;
|
||||
|
||||
if (targetUser.bot) {
|
||||
return; // Wait, I need to send the reply inside the if.
|
||||
return;
|
||||
}
|
||||
|
||||
const user = await userService.getOrCreateUser(targetUser.id, targetUser.username);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
import { createCommand } from "@/lib/utils";
|
||||
import { SlashCommandBuilder, EmbedBuilder, MessageFlags } from "discord.js";
|
||||
import { SlashCommandBuilder, EmbedBuilder } from "discord.js";
|
||||
import { economyService } from "@/modules/economy/economy.service";
|
||||
import { createSuccessEmbed, createErrorEmbed } from "@lib/embeds";
|
||||
import { createErrorEmbed } from "@lib/embeds";
|
||||
import { UserError } from "@/lib/errors";
|
||||
|
||||
export const daily = createCommand({
|
||||
|
||||
@@ -4,7 +4,7 @@ import { SlashCommandBuilder, EmbedBuilder, MessageFlags } from "discord.js";
|
||||
import { economyService } from "@/modules/economy/economy.service";
|
||||
import { userService } from "@/modules/user/user.service";
|
||||
import { config } from "@/lib/config";
|
||||
import { createSuccessEmbed, createErrorEmbed } from "@lib/embeds";
|
||||
import { createErrorEmbed } from "@lib/embeds";
|
||||
import { UserError } from "@/lib/errors";
|
||||
|
||||
export const pay = createCommand({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createCommand } from "@/lib/utils";
|
||||
import { SlashCommandBuilder, EmbedBuilder, MessageFlags } from "discord.js";
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { inventoryService } from "@/modules/inventory/inventory.service";
|
||||
import { userService } from "@/modules/user/user.service";
|
||||
import { createErrorEmbed, createSuccessEmbed } from "@lib/embeds";
|
||||
|
||||
@@ -15,8 +15,6 @@ const event: Event<Events.MessageCreate> = {
|
||||
levelingService.processChatXp(message.author.id);
|
||||
|
||||
// Activity Tracking for Lootdrops
|
||||
// We do dynamic import to avoid circular dependency issues if any, though likely not needed here.
|
||||
// But better safe for modules. Actually direct import is fine if structure is clean.
|
||||
import("@/modules/economy/lootdrop.service").then(m => m.lootdropService.processMessage(message));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@ const event: Event<Events.ClientReady> = {
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
// Send intermediate update if possible, though ready event should be fast.
|
||||
// Maybe just run it and report result.
|
||||
const { stdout: dbOut } = await execAsync("bun run db:push:local");
|
||||
migrationOutput = dbOut;
|
||||
} catch (dbErr: any) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { AuroraClient } from '@/lib/BotClient';
|
||||
|
||||
const configPath = join(process.cwd(), 'config', 'config.json');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type TextBasedChannel, User, Client } from 'discord.js';
|
||||
import { type TextBasedChannel, User } from 'discord.js';
|
||||
|
||||
/**
|
||||
* Sends a message to a channel using a temporary webhook (imitating the bot or custom persona).
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, test, expect, spyOn, beforeEach, mock } from "bun:test";
|
||||
import { handleItemWizardInteraction, renderWizard } from "./item_wizard";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
import { ButtonInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from "discord.js";
|
||||
|
||||
// Mock Setup
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, it, expect, mock, beforeEach } from "bun:test";
|
||||
import { classService } from "./class.service";
|
||||
import { classes, users } from "@/db/schema";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
|
||||
// Define mock functions
|
||||
const mockFindMany = mock();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, it, expect, mock, beforeEach, afterEach, spyOn } from "bun:test";
|
||||
import { lootdropService } from "./lootdrop.service";
|
||||
import { lootdrops } from "@/db/schema";
|
||||
import { eq, and, isNull } from "drizzle-orm";
|
||||
import { economyService } from "./economy.service";
|
||||
|
||||
// Mock dependencies BEFORE using service functionality
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, mock, beforeEach, afterEach, spyOn } from "bun:test";
|
||||
import { inventoryService } from "./inventory.service";
|
||||
import { inventory, items, userTimers } from "@/db/schema";
|
||||
import { inventory, userTimers } from "@/db/schema";
|
||||
// Helper to mock resolved value for spyOn
|
||||
import { economyService } from "@/modules/economy/economy.service";
|
||||
import { levelingService } from "@/modules/leveling/leveling.service";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, it, expect, mock, beforeEach, afterEach, setSystemTime } from "bun:test";
|
||||
import { levelingService } from "./leveling.service";
|
||||
import { users, userTimers } from "@/db/schema";
|
||||
import { eq, and } from "drizzle-orm";
|
||||
|
||||
// Mock dependencies
|
||||
const mockFindFirst = mock();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { quests, userQuests, users } from "@/db/schema";
|
||||
import { eq, and, sql } from "drizzle-orm";
|
||||
import { userQuests } from "@/db/schema";
|
||||
import { eq, and } from "drizzle-orm";
|
||||
import { UserError } from "@/lib/errors";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
import { economyService } from "@/modules/economy/economy.service";
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { TradeSession, TradeParticipant } from "./trade.types";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
import { withTransaction } from "@/lib/db";
|
||||
import { UserError } from "@/lib/errors";
|
||||
import { economyService } from "@/modules/economy/economy.service";
|
||||
import { inventoryService } from "@/modules/inventory/inventory.service";
|
||||
import { itemTransactions } from "@/db/schema";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { describe, it, expect, mock, beforeEach, afterEach } from "bun:test";
|
||||
import { describe, it, expect, mock, beforeEach } from "bun:test";
|
||||
import { userService } from "./user.service";
|
||||
|
||||
// Define mock functions outside so we can control them in tests
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { users } from "@/db/schema";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
|
||||
export const userService = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { userTimers } from "@/db/schema";
|
||||
import { eq, and, lt } from "drizzle-orm";
|
||||
import { eq, and } from "drizzle-orm";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
|
||||
export type TimerType = 'COOLDOWN' | 'EFFECT' | 'ACCESS';
|
||||
|
||||
Reference in New Issue
Block a user