Files
keiko/src/events/threadCreate.ts
T
hikari 76e559876b
Node.js CI / CI (pull_request) Failing after 15s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 54s
feat: rewrite as moderation bot (Keiko)
Replaces the old AI companion bot with a full Discord moderation system.

Commands: warn, mute, unmute, kick, softban, ban, unban, prune
Logging: member join/leave, activity (messages/threads/voice), mod actions
Audit log: captures manual bans, kicks, timeouts, and unbans
Sanctions: posts to Hikari sanction API for all applicable actions

All commands are ephemeral and use Components v2. Permission and role
hierarchy checks are enforced on every applicable command.
2026-03-24 20:15:41 -07:00

43 lines
1.1 KiB
TypeScript

/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { logActivity } from "../modules/logActivity.js";
import { logger } from "../utils/logger.js";
import type { AnyThreadChannel } from "discord.js";
/**
* Logs thread creation events to the activity log channel.
* @param thread - The newly created thread channel.
* @returns A promise that resolves when the event has been logged.
*/
export const onThreadCreate = async(
thread: AnyThreadChannel,
): Promise<void> => {
try {
const createdBy = `<@${thread.ownerId}>`;
const fields = [
`**Thread**: ${thread.name} (\`${thread.id}\`)`,
`**Parent**: <#${thread.parentId ?? "Unknown"}>`,
`**Created By**: ${createdBy}`,
].join("\n");
await logActivity({
client: thread.client,
emoji: "🧵",
fields: fields,
title: "Thread Created",
});
} catch (error) {
await logger.error(
"Failed to log thread create",
error instanceof Error
? error
: new Error(String(error)),
);
}
};