mirror of
https://github.com/arthur-pbty/flint.git
synced 2026-08-01 20:29:03 +02:00
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:
@@ -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/execution/CommandExecutor.ts`: unified pipeline (permissions/cooldown/execute)
|
||||||
- `src/framework/handlers/prefixHandler.ts`: prefix entrypoint
|
- `src/framework/handlers/prefixHandler.ts`: prefix entrypoint
|
||||||
- `src/framework/handlers/slashHandler.ts`: slash entrypoint
|
- `src/framework/handlers/slashHandler.ts`: slash entrypoint
|
||||||
- `src/framework/presence/presenceStore.ts`: PostgreSQL presence storage
|
- `src/database/presence/presenceStore.ts`: PostgreSQL presence storage
|
||||||
- `src/framework/presence/presenceTypes.ts`: shared presence types/validation
|
- `src/types/presenceTypes.ts`: shared presence types/validation
|
||||||
- `src/i18n/*.json`: external i18n dictionaries
|
- `src/i18n/*.json`: external i18n dictionaries
|
||||||
- `src/commands/*`: business commands only (`execute`, optional `cooldown`)
|
- `src/commands/*`: business commands only (`execute`, optional `cooldown`)
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import {
|
|||||||
import { env } from "../framework/config/env.js";
|
import { env } from "../framework/config/env.js";
|
||||||
import { I18nService } from "../i18n/index.js";
|
import { I18nService } from "../i18n/index.js";
|
||||||
import { dispatchMemberMessage } from "../framework/memberMessages/memberMessageSender.js";
|
import { dispatchMemberMessage } from "../framework/memberMessages/memberMessageSender.js";
|
||||||
import { getMemberMessageStore } from "../framework/memberMessages/memberMessageStore.js";
|
import { getMemberMessageStore } from "../database/memberMessages/memberMessageStore.js";
|
||||||
import {
|
import {
|
||||||
MEMBER_MESSAGE_RENDER_TYPES,
|
MEMBER_MESSAGE_RENDER_TYPES,
|
||||||
isMemberMessageRenderTypeValue,
|
isMemberMessageRenderTypeValue,
|
||||||
} from "../framework/memberMessages/memberMessageTypes.js";
|
} from "../types/memberMessageTypes.js";
|
||||||
import type { CommandExecutionContext } from "../types/command.js";
|
import type { CommandExecutionContext } from "../types/command.js";
|
||||||
import type {
|
import type {
|
||||||
MemberMessageConfig,
|
MemberMessageConfig,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import type {
|
|||||||
PresenceState,
|
PresenceState,
|
||||||
PresenceStatusValue,
|
PresenceStatusValue,
|
||||||
} from "../types/presence.js";
|
} from "../types/presence.js";
|
||||||
import { getPresenceStore } from "../framework/presence/presenceStore.js";
|
import { getPresenceStore } from "../database/presence/presenceStore.js";
|
||||||
import {
|
import {
|
||||||
PRESENCE_TEMPLATE_REFRESH_INTERVAL_MS,
|
PRESENCE_TEMPLATE_REFRESH_INTERVAL_MS,
|
||||||
containsPresenceTemplateVariables,
|
containsPresenceTemplateVariables,
|
||||||
@@ -51,7 +51,7 @@ import {
|
|||||||
sanitizeActivityText,
|
sanitizeActivityText,
|
||||||
sanitizeActivityTexts,
|
sanitizeActivityTexts,
|
||||||
sanitizePresenceRotationIntervalSeconds,
|
sanitizePresenceRotationIntervalSeconds,
|
||||||
} from "../framework/presence/presenceTypes.js";
|
} from "../types/presenceTypes.js";
|
||||||
import type { CommandExecutionContext } from "../types/command.js";
|
import type { CommandExecutionContext } from "../types/command.js";
|
||||||
|
|
||||||
const presenceRuntimeByBotId = new Map<string, PresenceRuntimeState>();
|
const presenceRuntimeByBotId = new Map<string, PresenceRuntimeState>();
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Pool } from "pg";
|
import { Pool } from "pg";
|
||||||
|
|
||||||
import { env } from "../config/env.js";
|
import { env } from "../../framework/config/env.js";
|
||||||
import type {
|
import type {
|
||||||
MemberMessageConfig,
|
MemberMessageConfig,
|
||||||
MemberMessageKind,
|
MemberMessageKind,
|
||||||
@@ -9,7 +9,7 @@ import type {
|
|||||||
import {
|
import {
|
||||||
createDefaultMemberMessageConfig,
|
createDefaultMemberMessageConfig,
|
||||||
isMemberMessageRenderTypeValue,
|
isMemberMessageRenderTypeValue,
|
||||||
} from "./memberMessageTypes.js";
|
} from "../../types/memberMessageTypes.js";
|
||||||
|
|
||||||
const tableSql = `
|
const tableSql = `
|
||||||
CREATE TABLE IF NOT EXISTS bot_member_message_configs (
|
CREATE TABLE IF NOT EXISTS bot_member_message_configs (
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Pool } from "pg";
|
import { Pool } from "pg";
|
||||||
|
|
||||||
import { env } from "../config/env.js";
|
import { env } from "../../framework/config/env.js";
|
||||||
import type {
|
import type {
|
||||||
PresenceActivityTypeValue,
|
PresenceActivityTypeValue,
|
||||||
PresenceRow,
|
PresenceRow,
|
||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
sanitizeActivityText,
|
sanitizeActivityText,
|
||||||
sanitizeActivityTexts,
|
sanitizeActivityTexts,
|
||||||
sanitizePresenceRotationIntervalSeconds,
|
sanitizePresenceRotationIntervalSeconds,
|
||||||
} from "./presenceTypes.js";
|
} from "../../types/presenceTypes.js";
|
||||||
|
|
||||||
const tableSql = `
|
const tableSql = `
|
||||||
CREATE TABLE IF NOT EXISTS bot_presence_states (
|
CREATE TABLE IF NOT EXISTS bot_presence_states (
|
||||||
@@ -21,7 +21,7 @@ import type {
|
|||||||
TemplateSuffix,
|
TemplateSuffix,
|
||||||
} from "../../types/memberMessages.js";
|
} from "../../types/memberMessages.js";
|
||||||
import { renderMemberMessageImage } from "./memberMessageImage.js";
|
import { renderMemberMessageImage } from "./memberMessageImage.js";
|
||||||
import { getMemberMessageStore } from "./memberMessageStore.js";
|
import { getMemberMessageStore } from "../../database/memberMessages/memberMessageStore.js";
|
||||||
export type {
|
export type {
|
||||||
DispatchMemberMessageFailureReason,
|
DispatchMemberMessageFailureReason,
|
||||||
DispatchMemberMessageResult,
|
DispatchMemberMessageResult,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { Client } from "discord.js";
|
|||||||
|
|
||||||
import { env } from "../config/env.js";
|
import { env } from "../config/env.js";
|
||||||
import { hasTemplateVariable, renderTemplate } from "../utils/templateVariables.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;
|
export const PRESENCE_TEMPLATE_REFRESH_INTERVAL_MS = 60_000;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -22,8 +22,8 @@ import { I18nService } from "./i18n/index.js";
|
|||||||
import {
|
import {
|
||||||
initMemberMessageStore,
|
initMemberMessageStore,
|
||||||
shutdownMemberMessageStore,
|
shutdownMemberMessageStore,
|
||||||
} from "./framework/memberMessages/memberMessageStore.js";
|
} from "./database/memberMessages/memberMessageStore.js";
|
||||||
import { initPresenceStore, shutdownPresenceStore } from "./framework/presence/presenceStore.js";
|
import { initPresenceStore, shutdownPresenceStore } from "./database/presence/presenceStore.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attache des handlers pour un arrêt gracieux du process.
|
* Attache des handlers pour un arrêt gracieux du process.
|
||||||
|
|||||||
+2
-2
@@ -2,9 +2,9 @@ import type {
|
|||||||
MemberMessageConfig,
|
MemberMessageConfig,
|
||||||
MemberMessageKind,
|
MemberMessageKind,
|
||||||
MemberMessageRenderType,
|
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"];
|
export const MEMBER_MESSAGE_KINDS: readonly MemberMessageKind[] = ["welcome", "goodbye"];
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ import type {
|
|||||||
PresenceActivityTypeValue,
|
PresenceActivityTypeValue,
|
||||||
PresenceState,
|
PresenceState,
|
||||||
PresenceStatusValue,
|
PresenceStatusValue,
|
||||||
} from "../../types/presence.js";
|
} from "./presence.js";
|
||||||
|
|
||||||
export const PRESENCE_STATUSES: readonly PresenceStatusValue[] = ["online", "idle", "dnd", "invisible", "streaming"];
|
export const PRESENCE_STATUSES: readonly PresenceStatusValue[] = ["online", "idle", "dnd", "invisible", "streaming"];
|
||||||
export const PRESENCE_ACTIVITY_TYPES: readonly PresenceActivityTypeValue[] = [
|
export const PRESENCE_ACTIVITY_TYPES: readonly PresenceActivityTypeValue[] = [
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
parsePresenceState,
|
parsePresenceState,
|
||||||
sanitizeActivityTexts,
|
sanitizeActivityTexts,
|
||||||
sanitizePresenceRotationIntervalSeconds,
|
sanitizePresenceRotationIntervalSeconds,
|
||||||
} from "../src/framework/presence/presenceTypes.js";
|
} from "../src/types/presenceTypes.js";
|
||||||
|
|
||||||
test("sanitizeActivityTexts fallback sur le texte par defaut", () => {
|
test("sanitizeActivityTexts fallback sur le texte par defaut", () => {
|
||||||
const texts = sanitizeActivityTexts([" ", ""]);
|
const texts = sanitizeActivityTexts([" ", ""]);
|
||||||
|
|||||||
Reference in New Issue
Block a user