feat(shared): reorder AppError constructor to (message, code, status), add singleton logger, retry and TTL cache utilities
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import type { WebSocket } from "ws";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import type { MediaState } from "../voice-recording/mediaTypes.js";
|
||||
import type {
|
||||
AnalysisQueueStatus,
|
||||
AttachmentRecord,
|
||||
MediaState,
|
||||
MessageRecord,
|
||||
ModerationWsEvent,
|
||||
} from "../message-capture/types.js";
|
||||
|
||||
@@ -171,33 +171,6 @@ export interface AnalysisResult {
|
||||
evidence?: string[];
|
||||
}
|
||||
|
||||
export type MediaMode = "music" | "screen";
|
||||
export type MediaSourceKind =
|
||||
| "url"
|
||||
| "local"
|
||||
| "youtube"
|
||||
| "spotify"
|
||||
| "search";
|
||||
export type MediaQueueItemStatus = "queued" | "playing" | "failed";
|
||||
|
||||
export interface MediaQueueItem {
|
||||
id: string;
|
||||
mode: MediaMode;
|
||||
source: string;
|
||||
title: string;
|
||||
kind: MediaSourceKind;
|
||||
requestedBy: string;
|
||||
addedAt: number;
|
||||
status: MediaQueueItemStatus;
|
||||
}
|
||||
|
||||
export interface MediaState {
|
||||
playing: boolean;
|
||||
musicVolume: number;
|
||||
current: MediaQueueItem | null;
|
||||
queue: MediaQueueItem[];
|
||||
}
|
||||
|
||||
export type ModerationWsEvent =
|
||||
| { type: "ui_state"; state: unknown }
|
||||
| { type: "user_state"; users: unknown[] }
|
||||
@@ -207,7 +180,7 @@ export type ModerationWsEvent =
|
||||
| { type: "message_analyzed"; data: MessageRecord }
|
||||
| { type: "attachment_created"; data: AttachmentRecord }
|
||||
| { type: "analysis_queue_status"; data: AnalysisQueueStatus }
|
||||
| { type: "media_state"; state: MediaState }
|
||||
| { type: "media_state"; state: unknown }
|
||||
| { type: "voice_recording_uploaded"; data: any };
|
||||
|
||||
export interface AnalysisQueueStatus {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getVoiceConnection, type VoiceConnection } from "@discordjs/voice";
|
||||
import type { Client, Guild, VoiceChannel } from "discord.js-selfbot-v13";
|
||||
import { AppError } from "../../shared/errors/errors.js";
|
||||
import { AppError } from "@bete/shared/errors";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { discordPlayer } from "./player.js";
|
||||
import { startRecording, stopRecording } from "./recorder.js";
|
||||
|
||||
Reference in New Issue
Block a user