/** * Discord Bot API operation enum — single source of truth across the * API, Dashboard, and any future consumers (Message Broker, MCP server). * Used by: * - discordAction entity / DTO (api): operation field + validation * - dashboard DiscordAction operation picker + form generation * - MCP toolkit-specs expansion (one aiEnabled discordAction → N tools) * * Targets Discord API v10 (the current stable as of 2026). Each op maps * to a single REST call — most go through the Bot Token to the channel/ * guild/user resource. createThread + createChannel + sendDM each have * their own multi-step flows handled inside the dispatcher. * * Phase 1 covers 17 ops that handle the bulk of bot automation * (messaging, channel CRUD, threads, DMs, role membership, lookups). * Phase 1.5 candidates (kick / ban / timeout / role CRUD / bulk delete / * forum-post create) extend this list — bump the package and re-install * in consumers, same pattern as Gmail / Calendar / Drive / Telegram. */ import { type CapacidadesPorCredencial } from './capacidad-de-credencial.js'; export declare const DISCORD_OPERATIONS: readonly ["sendMessage", "editMessage", "deleteMessage", "getMessage", "addReaction", "removeReaction", "pinMessage", "createChannel", "editChannel", "deleteChannel", "getChannel", "listChannels", "createThread", "sendDM", "addRole", "removeRole", "getMember"]; export type DiscordOperation = (typeof DISCORD_OPERATIONS)[number]; /** Type guard — useful when validating untrusted input (DTOs, tool calls). */ export declare function isDiscordOperation(value: unknown): value is DiscordOperation; export interface DiscordParamSpec { /** Field key — also the property name on operationConfig / payload. */ name: string; /** UI label. Carries the "(optional)" suffix when the form shows one. */ label: string; /** * Param type for form rendering + AI tool schema. * * `channel`, `string`, `text`, `number`, `boolean` and `emoji` mean the same * as in SlackParamSpec. `guild`, `role`, `member` and `select` are Discord's * own: the first three map to its resource pickers, and `select` is a fixed * option list (channel kind, thread kind, archive window) that Slack has no * equivalent for. */ type: 'channel' | 'guild' | 'role' | 'member' | 'string' | 'text' | 'number' | 'boolean' | 'emoji' | 'select'; /** Required at submit time. */ required?: boolean; /** Human description — also used as the AI tool param description. */ description: string; /** Hint shown inside the input. */ placeholder?: string; /** Value to show when the stored one is undefined. */ default?: string | number | boolean; /** `select` only — the fixed option list, in display order. */ options?: Array<{ value: string | number; label: string; }>; /** `number` only. */ min?: number; max?: number; /** `text` only — height of the textarea. */ rows?: number; /** `channel` only — let categories be picked, for parent-category fields. */ allowCategories?: boolean; /** `boolean` only — the bold line beside the switch. */ switchLabel?: string; } export interface DiscordOperationSpec { /** UI label for the operation picker. */ label: string; /** Description shown in the picker + reused by the AI tool description * when the user hasn't set a custom one on the entity. */ description: string; /** Route the operation maps to in Discord's docs (discord.com/developers). */ apiMethod: string; /** Parameter schema. Order matters for form rendering. */ params: DiscordParamSpec[]; } export declare const DISCORD_OPERATION_SPECS: Record; /** * Lo que puede hacer una credencial de Discord que NO es de bot. * * Medido contra la documentación de Discord, no de memoria: * https://docs.discord.com/developers/resources/webhook * * `Execute Webhook` publica, y `Get/Edit/Delete Webhook Message` leen, editan y * borran mensajes — pero **sólo los que envió ese mismo webhook**, y sólo en el * canal para el que se creó. Las otras 13 (reacciones, pins, CRUD de canales, * crear hilos, DMs, roles, miembros) piden un Bot Token: la propia doc las * marca con `MANAGE_WEBHOOKS` o con permisos de guild. * * Los tres campos que se caen de `sendMessage`, uno por uno: * * - `channelId`: la URL del webhook YA dice el canal. El endpoint ni siquiera * acepta `channel_id`. * - `replyToMessageId`: `Execute Webhook` no acepta `message_reference`. No * es que venga fijado — es que responder no existe por esta vía. * - `interactionReply`: contestar a un slash command es cosa de la * aplicación, no de un webhook. * * `threadId` SÍ se queda: `?thread_id=` es parámetro de query del endpoint. */ export declare const DISCORD_CAPACIDADES_POR_CREDENCIAL: CapacidadesPorCredencial; /** Las operaciones que ofrecer para una credencial de Discord. */ export declare function operacionesDeDiscordPara(tipoDeCredencial: string | null | undefined): readonly DiscordOperation[]; /** Si esa credencial puede ejecutar esa operación de Discord. */ export declare function discordPuedeEjecutar(tipoDeCredencial: string | null | undefined, operacion: DiscordOperation): boolean; /** Los campos que esa credencial de Discord no deja elegir. */ export declare function camposDeDiscordNoDisponibles(tipoDeCredencial: string | null | undefined): ReadonlySet;