chore(format): auto-format files with biome

This commit is contained in:
MythEclipse
2026-06-04 18:52:56 +07:00
parent 367d8696c8
commit d1d4510ce8
33 changed files with 342 additions and 157 deletions
@@ -1,6 +1,6 @@
import { createChildLogger } from "@bete/shared/logger";
import type { Client, PermissionString } from "discord.js-selfbot-v13";
import { config } from "../../shared/config/config.js";
import { createChildLogger } from "@bete/shared/logger";
import { createModerationAction } from "../message-capture/messageStore.js";
import type { MessageRecord } from "../message-capture/types.js";
@@ -323,17 +323,22 @@ export async function attemptAutoDeleteFlaggedMessage(
try {
const targetUser = await client.users.fetch(message.user_id);
if (targetUser) {
const reason = message.ai_categories ?? message.ai_moderation_flags ?? "(unknown)";
const reason =
message.ai_categories ?? message.ai_moderation_flags ?? "(unknown)";
await targetUser.send(
`Pesan Anda di **${guild.name}** telah dihapus oleh sistem moderasi otomatis.\n` +
`Alasan: ${reason}\n` +
`Jika Anda merasa ini adalah kesalahan, silakan hubungi admin server.`,
`Alasan: ${reason}\n` +
`Jika Anda merasa ini adalah kesalahan, silakan hubungi admin server.`,
);
}
} catch (dmErr) {
// DM might fail if user has DMs disabled — not critical
logger.debug(
{ messageId: message.id, userId: message.user_id, error: String(dmErr) },
{
messageId: message.id,
userId: message.user_id,
error: String(dmErr),
},
"Failed to send DM notification for auto-deleted message",
);
}
@@ -342,18 +347,28 @@ export async function attemptAutoDeleteFlaggedMessage(
// ── Log to moderation channel ──
if (config.AUTO_DELETE_LOG_CHANNEL_ID) {
try {
const logChannel = guild.channels.cache.get(config.AUTO_DELETE_LOG_CHANNEL_ID);
if (logChannel && "send" in logChannel && typeof (logChannel as any).send === "function") {
const logChannel = guild.channels.cache.get(
config.AUTO_DELETE_LOG_CHANNEL_ID,
);
if (
logChannel &&
"send" in logChannel &&
typeof (logChannel as any).send === "function"
) {
const severity = message.ai_severity ?? "none";
const categories = message.ai_categories ?? message.ai_moderation_flags ?? "—";
const snippet = (message.edited_content ?? message.content).substring(0, 200);
const categories =
message.ai_categories ?? message.ai_moderation_flags ?? "—";
const snippet = (message.edited_content ?? message.content).substring(
0,
200,
);
await (logChannel as any).send(
`**🧹 Auto-Delete** — Pesan dari <@${message.user_id}> di <#${channelId}>\n` +
`**Status:** ${message.ai_status}\n` +
`**Severitas:** ${severity}\n` +
`**Kategori:** ${categories}\n` +
`**Isi:** ${snippet}\n` +
`**Waktu:** <t:${Math.floor(Date.now() / 1000)}:R>`,
`**Status:** ${message.ai_status}\n` +
`**Severitas:** ${severity}\n` +
`**Kategori:** ${categories}\n` +
`**Isi:** ${snippet}\n` +
`**Waktu:** <t:${Math.floor(Date.now() / 1000)}:R>`,
);
}
} catch (logErr) {