import type { Signal, SignalAdapter } from '../types.ts' export const discordAdapter: SignalAdapter = { id: 'discord', displayName: 'Discord', normalize(raw, ctx) { const rec = (raw && typeof raw === 'object' ? raw : {}) as Record const id = String(rec.id ?? rec.messageId ?? 'unknown') const signal: Signal = { id: `sig_${crypto.randomUUID().replace(/-/g, '').slice(0, 12)}`, projectId: ctx.projectId, source: 'discord', externalId: id, fingerprint: `discord:${rec.channelId ?? 'ch'}:${id}`, title: String(rec.content ?? 'Discord message').slice(0, 120), body: String(rec.content ?? ''), severity: 'info', labels: ['discord'], links: [], repoRef: null, receivedAt: new Date().toISOString(), } return [signal] }, }