Skip to content
← Public packages

@kody/kody-factory

Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.

FollowFork

Files

discord.ts

25 lines · 783 B · TypeScript
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<string, unknown>
		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]
	},
}