chore(lint): biome cleanup across services — format, sort imports, drop unused
- discord-gateway: 74 lint errors -> 0 (format, import sorting, unused imports/vars, dead breath var) - backend: format + sort imports (11 warnings left: noExplicitAny) - frontend: remove unused imports, drop dead breathing var, fix useExhaustiveDependencies (scroll keyed on messages), a11y biome-ignore for drag surface + stopPropagation container (mouse-only gestures) - remaining warnings are false positives: index keys on static lists, <img> in static export (next/image unsupported), noExplicitAny tsc --noEmit clean on all 3 services; vitest green (60+36).
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { ConfigError, DatabaseError } from "@/shared/errors/index";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { Client } from "discord.js-selfbot-v13";
|
||||
import { inArray, lt } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { ConfigError, DatabaseError } from "@/shared/errors/index";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { startPendingAIAnalysisWorker } from "../modules/ai-moderation/aiAnalyzer.js";
|
||||
import { registerChannelTopicCapture } from "../modules/channel-topic/index.js";
|
||||
import { CommandHandler } from "../modules/command-handler/commandHandler.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { inArray, lt } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../shared/config/config.js";
|
||||
import { getDatabase } from "../shared/database/drizzle.js";
|
||||
import type * as schema from "../shared/database/schema.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import type { createChildLogger } from "@/shared/logger/index";
|
||||
import type { CommandHandler } from "../modules/command-handler/commandHandler.js";
|
||||
import type { EventBroadcaster } from "../modules/event-broadcaster/index.js";
|
||||
import type { stopMetricsServer } from "../modules/gateway-metrics/index.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Guild } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, PermissionString } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import {
|
||||
type ChannelCulture,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { encoding_for_model as encodingForModel } from "tiktoken";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import {
|
||||
formatMediaEvidenceForPrompt,
|
||||
renderDiscordMentions,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { LAST_ERROR } from "./moderationState.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, sql } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -27,7 +27,16 @@ export function sanitizeDiscordTokens(content: string): string {
|
||||
if (!content.includes("<")) return content;
|
||||
return content.replace(
|
||||
DISCORD_TOKEN_RE,
|
||||
(_full, emojiName, _emojiId, _userId, _roleId, _channelId, _time, _style) => {
|
||||
(
|
||||
_full,
|
||||
emojiName,
|
||||
_emojiId,
|
||||
_userId,
|
||||
_roleId,
|
||||
_channelId,
|
||||
_time,
|
||||
_style,
|
||||
) => {
|
||||
if (emojiName) return `[emoji:${emojiName}]`;
|
||||
// Capture groups tell us which alternative matched by position:
|
||||
// 3=user, 4=role, 5=channel, 6=time
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
export { startPendingAIAnalysisWorker } from "./aiAnalyzer.js";
|
||||
export { runModerationAnalysis } from "./moderationOrchestrator.js";
|
||||
export { buildSystemPrompt } from "./moderationPrompt.js";
|
||||
export { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
|
||||
// ── Single-pass LLM pipeline exports ─────────────────────────────────────
|
||||
export type {
|
||||
AnalysisInput,
|
||||
AnalysisResult,
|
||||
WorkerConfig,
|
||||
MessageBatch,
|
||||
WorkerConfig,
|
||||
} from "./ai-analysis-worker.js";
|
||||
export { startPendingAIAnalysisWorker } from "./aiAnalyzer.js";
|
||||
export { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
export { runModerationAnalysis } from "./moderationOrchestrator.js";
|
||||
export { buildSystemPrompt } from "./moderationPrompt.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type {
|
||||
@@ -99,9 +99,7 @@ async function processIndividualFallback(
|
||||
// retryable error — the recovery worker picks it up later. Producing a
|
||||
// regex/wordlist verdict here would reintroduce false positives.
|
||||
if (!analysisResult) {
|
||||
throw new Error(
|
||||
`LLM analysis failed for message ${messageId}`,
|
||||
);
|
||||
throw new Error(`LLM analysis failed for message ${messageId}`);
|
||||
}
|
||||
|
||||
// Main thread: DB writes + broadcast
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* Used by both mediaAnalysisClient.ts and moderationOrchestrator.ts.
|
||||
*/
|
||||
|
||||
import { renderDiscordMentions } from "../message-capture/messageMetadata.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
import { renderDiscordMentions } from "../message-capture/messageMetadata.js";
|
||||
import { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
|
||||
/** Simple XML-escaping for content text. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { z } from "zod";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { AnalysisResult } from "../message-capture/types.js";
|
||||
import type {
|
||||
RecommendedActionSchema,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { z } from "zod";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
|
||||
const log = createChildLogger("moderationSchemas");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/index.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Redis from "ioredis";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { createAbortControllerWithTimeout } from "@/shared/utils/index";
|
||||
import Redis from "ioredis";
|
||||
|
||||
const log = createChildLogger("searxng-search");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, sql } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import {
|
||||
type UserProfile,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import sharp from "sharp";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
|
||||
const log = createChildLogger("imageResizer");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, TextChannel } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import Redis from "ioredis";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import {
|
||||
BACKEND_COMMAND,
|
||||
type CommandMessage,
|
||||
@@ -6,9 +9,6 @@ import {
|
||||
VOICE_STATUS_KEY,
|
||||
} from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import Redis from "ioredis";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { VoiceController } from "../voice-recording/voiceController.js";
|
||||
import { GuildHandler } from "./guild.handler.js";
|
||||
import {
|
||||
@@ -82,7 +82,9 @@ export class CommandHandler {
|
||||
|
||||
// Create domain-specific handlers with their dependencies
|
||||
this.voiceHandler = new VoiceHandler(client, voiceController);
|
||||
this.mediaHandler = new MediaHandler(client, () => voiceController.getStatus());
|
||||
this.mediaHandler = new MediaHandler(client, () =>
|
||||
voiceController.getStatus(),
|
||||
);
|
||||
this.guildHandler = new GuildHandler(client);
|
||||
this.moderationHandler = new ModerationHandler(client);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import type { CommandMessage, CommandReply } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// GuildHandler
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { StreamType } from "@discordjs/voice";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import type { CommandMessage, CommandReply } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import { StreamType } from "@discordjs/voice";
|
||||
import {
|
||||
extractMediaInfo,
|
||||
resolveMediaUrl,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import type { CommandMessage, CommandReply } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { CommandMessage, CommandReply } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { CommandMessage, CommandReply } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import { discordPlayer } from "../voice-recording/player.js";
|
||||
import { voiceTransmitter } from "../voice-recording/transmitter.js";
|
||||
import type { VoiceController } from "../voice-recording/voiceController.js";
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import type { AttachmentRecord, MessageRecord } from "../../shared/index.js";
|
||||
import { type CustomLogger, createChildLogger } from "../../shared/logger/index.js";
|
||||
import Redis from "ioredis";
|
||||
import type { AttachmentRecord, MessageRecord } from "../../shared/index.js";
|
||||
import {
|
||||
type CustomLogger,
|
||||
createChildLogger,
|
||||
} from "../../shared/logger/index.js";
|
||||
import { type DiscordGatewayEvent, EventChannels } from "./eventTypes.js";
|
||||
|
||||
export class RedisEventPublisher {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type {
|
||||
Client,
|
||||
GuildMember,
|
||||
PartialGuildMember,
|
||||
} from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, inArray, type SQL } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { attachmentsTable } from "../../shared/database/schema.js";
|
||||
import type { AttachmentRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, Message } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { queueMessageAnalysis } from "../ai-moderation/aiAnalyzer.js";
|
||||
import { processAttachmentUpload } from "../attachment-upload/attachmentUploader.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import type {
|
||||
@@ -327,7 +327,9 @@ export const messageStore: MessageStore = new Proxy<MessageStore>(
|
||||
{
|
||||
get(_, prop: string | symbol) {
|
||||
const store = resolveStore();
|
||||
const value = (store as unknown as Record<string | symbol, unknown>)[prop];
|
||||
const value = (store as unknown as Record<string | symbol, unknown>)[
|
||||
prop
|
||||
];
|
||||
return typeof value === "function" ? value.bind(store) : value;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, asc, desc, eq, inArray, isNull, or, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, eq, isNull, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, or, type SQL } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import {
|
||||
messageEditsTable,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import type {
|
||||
MessageQuery,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import { and, desc, eq, inArray, type SQL, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import type {
|
||||
MessageQuery,
|
||||
MessageRecord,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, isNull, or, type SQL, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import { and, desc, eq, inArray, type SQL, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { moderationActionsTable } from "../../shared/database/schema.js";
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import type { ModerationAction, PageResult } from "../message-capture/types.js";
|
||||
|
||||
// ─── ModerationActionsDb Class ──────────────────────────────────────────────
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import { and, eq, isNull, or } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger, type Logger } from "@/shared/logger/index";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { retentionPoliciesTable } from "../../shared/database/schema.js";
|
||||
import type { RetentionPolicy } from "../message-capture/types.js";
|
||||
@@ -45,8 +45,7 @@ export class RetentionDb {
|
||||
),
|
||||
);
|
||||
|
||||
if (channelRows.length > 0)
|
||||
return channelRows[0] as RetentionPolicy;
|
||||
if (channelRows.length > 0) return channelRows[0] as RetentionPolicy;
|
||||
}
|
||||
|
||||
// Fall back to the guild default (channel_id IS NULL)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import { and, desc, eq, inArray, type SQL, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { messageReviewsTable } from "../../shared/database/schema.js";
|
||||
import { buildCursorCondition, pageResult } from "../../shared/index.js";
|
||||
import { createChildLogger, type Logger } from "../../shared/logger/index.js";
|
||||
import type { MessageReview, PageResult } from "../message-capture/types.js";
|
||||
|
||||
// ─── ReviewsDb Class ────────────────────────────────────────────────────────
|
||||
@@ -94,7 +94,9 @@ export class ReviewsDb {
|
||||
conditions.push(
|
||||
inArray(
|
||||
messageReviewsTable.status,
|
||||
query.status as Array<"pending" | "approved" | "rejected" | "escalated">,
|
||||
query.status as Array<
|
||||
"pending" | "approved" | "rejected" | "escalated"
|
||||
>,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type fs from "node:fs";
|
||||
import type prism from "prism-media";
|
||||
import type {
|
||||
AnalysisQueueStatus,
|
||||
AttachmentRecord,
|
||||
@@ -6,7 +7,6 @@ import type {
|
||||
UserMetadata,
|
||||
VoiceRecordingUploadData,
|
||||
} from "../../shared/index.js";
|
||||
import type prism from "prism-media";
|
||||
|
||||
// Re-export all shared types for backward compatibility
|
||||
export type {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type {
|
||||
Client,
|
||||
MessageReaction,
|
||||
@@ -6,6 +5,7 @@ import type {
|
||||
PartialUser,
|
||||
User,
|
||||
} from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import { reactionsTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, ThreadChannel } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, Presence } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* The backend forwards these unchanged to frontend clients.
|
||||
*/
|
||||
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import WebSocket from "ws";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
|
||||
const logger = createChildLogger("voice-pcm-ws");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type ChildProcess, spawn } from "node:child_process";
|
||||
import { PassThrough, type Readable } from "node:stream";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { StreamType } from "@discordjs/voice";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
|
||||
const logger = createChildLogger("media-source");
|
||||
|
||||
@@ -348,7 +348,9 @@ export function getDirectVideoUrl(url: string): Promise<string> {
|
||||
if (code !== 0) {
|
||||
const detail = stderrBuf.trim() ? `: ${stderrBuf.trim()}` : "";
|
||||
reject(
|
||||
new Error(`yt-dlp direct URL resolution exited with code ${code}${detail}`),
|
||||
new Error(
|
||||
`yt-dlp direct URL resolution exited with code ${code}${detail}`,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import type * as schema from "../../shared/database/schema.js";
|
||||
import { muxerJobsTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Readable } from "node:stream";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import {
|
||||
type AudioPlayer,
|
||||
AudioPlayerStatus,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
StreamType,
|
||||
type VoiceConnection,
|
||||
} from "@discordjs/voice";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { DiscordPlayerOwner, DiscordPlayOptions } from "./mediaTypes.js";
|
||||
|
||||
const logger = createChildLogger("player");
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { promises as fsPromises } from "node:fs";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { retryWithBackoff } from "@/shared/utils/index";
|
||||
import {
|
||||
type DiscordGatewayAdapterCreator,
|
||||
entersState,
|
||||
@@ -10,6 +8,8 @@ import {
|
||||
VoiceConnectionStatus,
|
||||
} from "@discordjs/voice";
|
||||
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { retryWithBackoff } from "@/shared/utils/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
|
||||
import type { VoicePcmWsClient } from "../voice-pcm-ws/index.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createRequire } from "node:module";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import * as prism from "prism-media";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../../shared/config/config.js";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../../shared/config/config.js";
|
||||
import type {
|
||||
SegmentMetadata,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import * as prism from "prism-media";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { SegmentState } from "../../message-capture/types.js";
|
||||
|
||||
const logger = createChildLogger("voice-segment");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { promises as fsPromises } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { VoiceConnection } from "@discordjs/voice";
|
||||
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { EventBroadcaster } from "../../event-broadcaster/eventBroadcaster.js";
|
||||
import { collectUserMetadata } from "./metadata.js";
|
||||
import { finalizeSegment } from "./segmentFinalizer.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { VoiceConnection } from "@discordjs/voice";
|
||||
import { EndBehaviorType } from "@discordjs/voice";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../../shared/config/config.js";
|
||||
import { PacketFilter } from "../packetFilter.js";
|
||||
import { OpusDecoder } from "./decoder.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../../shared/config/config.js";
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
Encoders,
|
||||
prepareStream,
|
||||
playStream,
|
||||
prepareStream,
|
||||
Streamer,
|
||||
Utils,
|
||||
} from "@dank074/discord-video-stream";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { ScreenSharePlayback } from "./mediaTypes.js";
|
||||
import { getDirectVideoUrl } from "./mediaSource.js";
|
||||
import type { ScreenSharePlayback } from "./mediaTypes.js";
|
||||
import { discordPlayer } from "./player.js";
|
||||
|
||||
const logger = createChildLogger("screen-share");
|
||||
@@ -46,11 +46,7 @@ export class ScreenShareController {
|
||||
|
||||
async start(source: string): Promise<ScreenSharePlayback> {
|
||||
const status = this.getVoiceStatus();
|
||||
if (
|
||||
!status.connected ||
|
||||
!status.activeGuildId ||
|
||||
!status.activeChannelId
|
||||
) {
|
||||
if (!status.connected || !status.activeGuildId || !status.activeChannelId) {
|
||||
throw new Error("Connect to a voice channel before sharing screen");
|
||||
}
|
||||
|
||||
@@ -81,15 +77,13 @@ export class ScreenShareController {
|
||||
}).finally(() => {
|
||||
this.active = null;
|
||||
});
|
||||
|
||||
const controller = this;
|
||||
this.active = {
|
||||
done,
|
||||
stop: () => {
|
||||
if (stopped) return;
|
||||
stopped = true;
|
||||
command.kill("SIGTERM");
|
||||
controller.active = null;
|
||||
this.active = null;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { PassThrough } from "node:stream";
|
||||
import { BACKEND_VOICE_TRANSMIT } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import { StreamType } from "@discordjs/voice";
|
||||
import type Redis from "ioredis";
|
||||
import { BACKEND_VOICE_TRANSMIT } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
import { discordPlayer } from "./player.js";
|
||||
|
||||
const logger = createChildLogger("transmitter");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AppError } from "@/shared/errors/index";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { VoiceConnection } from "@discordjs/voice";
|
||||
import type { Client, Guild, VoiceChannel } from "discord.js-selfbot-v13";
|
||||
import { AppError } from "@/shared/errors/index";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { discordPlayer } from "./player.js";
|
||||
import { startRecording, stopRecording } from "./recorder.js";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// ─── Voice Transcription — AI-powered speech-to-text for voice recordings ────
|
||||
|
||||
import { createReadStream } from "node:fs";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import OpenAI from "openai";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
|
||||
const logger = createChildLogger("voice-transcriber");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "../logger/index.js";
|
||||
import { drizzle } from "drizzle-orm/node-postgres";
|
||||
import type { Pool, PoolClient } from "pg";
|
||||
import { createChildLogger } from "../logger/index.js";
|
||||
import { closePool, createPoolFromConfig } from "./pool.js";
|
||||
|
||||
const logger = createChildLogger("database.init");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import "dotenv/config";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { drizzle as drizzlePostgres } from "drizzle-orm/node-postgres";
|
||||
import { migrate as migratePostgres } from "drizzle-orm/node-postgres/migrator";
|
||||
import type { PoolClient } from "pg";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import {
|
||||
closeDatabase,
|
||||
initializeDatabase,
|
||||
|
||||
@@ -595,8 +595,7 @@ export type DbRetentionPolicyInsert =
|
||||
|
||||
// Chatbot Messages
|
||||
export type ChatbotMessage = typeof chatbotMessagesTable.$inferSelect;
|
||||
export type ChatbotMessageInsert =
|
||||
typeof chatbotMessagesTable.$inferInsert;
|
||||
export type ChatbotMessageInsert = typeof chatbotMessagesTable.$inferInsert;
|
||||
|
||||
// =============================================================================
|
||||
// Moderation Actions (gateway-local)
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import {
|
||||
pgAttachmentsTable,
|
||||
pgMessageReviewsTable,
|
||||
pgMessagesTable,
|
||||
} from "../../../shared/index.js";
|
||||
import {
|
||||
bigint as pgBigint,
|
||||
boolean as pgBoolean,
|
||||
@@ -11,6 +6,11 @@ import {
|
||||
text as pgText,
|
||||
uuid as pgUuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import {
|
||||
pgAttachmentsTable,
|
||||
pgMessageReviewsTable,
|
||||
pgMessagesTable,
|
||||
} from "../../../shared/index.js";
|
||||
|
||||
// Re-export shared message/attachment/review tables
|
||||
export { pgAttachmentsTable, pgMessageReviewsTable, pgMessagesTable };
|
||||
|
||||
@@ -25,5 +25,4 @@ export type UIStateInsert = typeof uiStateTable.$inferInsert;
|
||||
export type RetentionPolicy = typeof retentionPoliciesTable.$inferSelect;
|
||||
export type RetentionPolicyInsert = typeof retentionPoliciesTable.$inferInsert;
|
||||
export type ChatbotMessage = typeof chatbotMessagesTable.$inferSelect;
|
||||
export type ChatbotMessageInsert =
|
||||
typeof chatbotMessagesTable.$inferInsert;
|
||||
export type ChatbotMessageInsert = typeof chatbotMessagesTable.$inferInsert;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { desc, eq } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "./drizzle.js";
|
||||
import {
|
||||
type VoiceRecording,
|
||||
|
||||
Reference in New Issue
Block a user