refactor: réorganiser la structure des fichiers et déplacer les types et les magasins de données vers le dossier approprié

This commit is contained in:
Puechberty Arthur
2026-04-13 20:47:34 +02:00
parent 7ff76cdaba
commit 1de2a76b05
11 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -86,8 +86,8 @@ An example with two bot services is available in `docker-compose.multi-bot.examp
- `src/framework/execution/CommandExecutor.ts`: unified pipeline (permissions/cooldown/execute)
- `src/framework/handlers/prefixHandler.ts`: prefix entrypoint
- `src/framework/handlers/slashHandler.ts`: slash entrypoint
- `src/framework/presence/presenceStore.ts`: PostgreSQL presence storage
- `src/framework/presence/presenceTypes.ts`: shared presence types/validation
- `src/database/presence/presenceStore.ts`: PostgreSQL presence storage
- `src/types/presenceTypes.ts`: shared presence types/validation
- `src/i18n/*.json`: external i18n dictionaries
- `src/commands/*`: business commands only (`execute`, optional `cooldown`)
+2 -2
View File
@@ -25,11 +25,11 @@ import {
import { env } from "../framework/config/env.js";
import { I18nService } from "../i18n/index.js";
import { dispatchMemberMessage } from "../framework/memberMessages/memberMessageSender.js";
import { getMemberMessageStore } from "../framework/memberMessages/memberMessageStore.js";
import { getMemberMessageStore } from "../database/memberMessages/memberMessageStore.js";
import {
MEMBER_MESSAGE_RENDER_TYPES,
isMemberMessageRenderTypeValue,
} from "../framework/memberMessages/memberMessageTypes.js";
} from "../types/memberMessageTypes.js";
import type { CommandExecutionContext } from "../types/command.js";
import type {
MemberMessageConfig,
+2 -2
View File
@@ -32,7 +32,7 @@ import type {
PresenceState,
PresenceStatusValue,
} from "../types/presence.js";
import { getPresenceStore } from "../framework/presence/presenceStore.js";
import { getPresenceStore } from "../database/presence/presenceStore.js";
import {
PRESENCE_TEMPLATE_REFRESH_INTERVAL_MS,
containsPresenceTemplateVariables,
@@ -51,7 +51,7 @@ import {
sanitizeActivityText,
sanitizeActivityTexts,
sanitizePresenceRotationIntervalSeconds,
} from "../framework/presence/presenceTypes.js";
} from "../types/presenceTypes.js";
import type { CommandExecutionContext } from "../types/command.js";
const presenceRuntimeByBotId = new Map<string, PresenceRuntimeState>();
@@ -1,6 +1,6 @@
import { Pool } from "pg";
import { env } from "../config/env.js";
import { env } from "../../framework/config/env.js";
import type {
MemberMessageConfig,
MemberMessageKind,
@@ -9,7 +9,7 @@ import type {
import {
createDefaultMemberMessageConfig,
isMemberMessageRenderTypeValue,
} from "./memberMessageTypes.js";
} from "../../types/memberMessageTypes.js";
const tableSql = `
CREATE TABLE IF NOT EXISTS bot_member_message_configs (
@@ -1,6 +1,6 @@
import { Pool } from "pg";
import { env } from "../config/env.js";
import { env } from "../../framework/config/env.js";
import type {
PresenceActivityTypeValue,
PresenceRow,
@@ -15,7 +15,7 @@ import {
sanitizeActivityText,
sanitizeActivityTexts,
sanitizePresenceRotationIntervalSeconds,
} from "./presenceTypes.js";
} from "../../types/presenceTypes.js";
const tableSql = `
CREATE TABLE IF NOT EXISTS bot_presence_states (
@@ -21,7 +21,7 @@ import type {
TemplateSuffix,
} from "../../types/memberMessages.js";
import { renderMemberMessageImage } from "./memberMessageImage.js";
import { getMemberMessageStore } from "./memberMessageStore.js";
import { getMemberMessageStore } from "../../database/memberMessages/memberMessageStore.js";
export type {
DispatchMemberMessageFailureReason,
DispatchMemberMessageResult,
@@ -2,7 +2,7 @@ import type { Client } from "discord.js";
import { env } from "../config/env.js";
import { hasTemplateVariable, renderTemplate } from "../utils/templateVariables.js";
import { sanitizeActivityText } from "./presenceTypes.js";
import { sanitizeActivityText } from "../../types/presenceTypes.js";
export const PRESENCE_TEMPLATE_REFRESH_INTERVAL_MS = 60_000;
+2 -2
View File
@@ -22,8 +22,8 @@ import { I18nService } from "./i18n/index.js";
import {
initMemberMessageStore,
shutdownMemberMessageStore,
} from "./framework/memberMessages/memberMessageStore.js";
import { initPresenceStore, shutdownPresenceStore } from "./framework/presence/presenceStore.js";
} from "./database/memberMessages/memberMessageStore.js";
import { initPresenceStore, shutdownPresenceStore } from "./database/presence/presenceStore.js";
/**
* Attache des handlers pour un arrêt gracieux du process.
@@ -2,9 +2,9 @@ import type {
MemberMessageConfig,
MemberMessageKind,
MemberMessageRenderType,
} from "../../types/memberMessages.js";
} from "./memberMessages.js";
export type { MemberMessageConfig, MemberMessageKind, MemberMessageRenderType } from "../../types/memberMessages.js";
export type { MemberMessageConfig, MemberMessageKind, MemberMessageRenderType } from "./memberMessages.js";
export const MEMBER_MESSAGE_KINDS: readonly MemberMessageKind[] = ["welcome", "goodbye"];
@@ -2,7 +2,7 @@ import type {
PresenceActivityTypeValue,
PresenceState,
PresenceStatusValue,
} from "../../types/presence.js";
} from "./presence.js";
export const PRESENCE_STATUSES: readonly PresenceStatusValue[] = ["online", "idle", "dnd", "invisible", "streaming"];
export const PRESENCE_ACTIVITY_TYPES: readonly PresenceActivityTypeValue[] = [
+1 -1
View File
@@ -8,7 +8,7 @@ import {
parsePresenceState,
sanitizeActivityTexts,
sanitizePresenceRotationIntervalSeconds,
} from "../src/framework/presence/presenceTypes.js";
} from "../src/types/presenceTypes.js";
test("sanitizeActivityTexts fallback sur le texte par defaut", () => {
const texts = sanitizeActivityTexts([" ", ""]);