fix: resolve architecture disconnects and codebase weaknesses

- Standardize MessageRecord types — single source of truth from @bete/shared
- Clean up config: remove unused GUILD_ID/TEXT_GUILD_ID/TEXT_CHANNEL_ID, fix WEBSERVER_PORT default (3001), remove default admin password
- Move mascot_chat_messages table to Drizzle schema with proper migration
- Remove runtime DDL (CREATE TABLE IF NOT EXISTS) from mascot-chat repository
- Remove phantom analytics/ module from documentation
- Add better-sqlite3 dependency to root devDependencies
- Replace 'as any' casts with proper type assertions across AI moderation
- Add error logging to silent catch blocks in LLM client
- Apply Biome formatting and import organization

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-09 13:07:01 +07:00
co-authored by Claude Opus 4.8
parent 67d66bb5dd
commit 3614d32701
21 changed files with 206 additions and 150 deletions
@@ -4,6 +4,10 @@ import { config } from "../../shared/config/config.js";
import { createModerationAction } from "../message-capture/messageStore.js";
import type { MessageRecord } from "../message-capture/types.js";
interface ChannelWithSend {
send: (content: string | object, options?: unknown) => Promise<unknown>;
}
const logger = createChildLogger("auto-delete-manager");
const parseStringList = (value?: string | null): string[] => {
@@ -353,7 +357,7 @@ export async function attemptAutoDeleteFlaggedMessage(
if (
logChannel &&
"send" in logChannel &&
typeof (logChannel as any).send === "function"
typeof (logChannel as ChannelWithSend).send === "function"
) {
const severity = message.ai_severity ?? "none";
const categories =
@@ -362,7 +366,7 @@ export async function attemptAutoDeleteFlaggedMessage(
0,
200,
);
await (logChannel as any).send(
await (logChannel as ChannelWithSend).send(
`**🧹 Auto-Delete** — Pesan dari <@${message.user_id}> di <#${channelId}>\n` +
`**Status:** ${message.ai_status}\n` +
`**Severitas:** ${severity}\n` +