/** * Discord Gateway for MAMA Standalone * * Provides Discord bot integration for receiving and responding to messages. * Supports both DM and channel mentions with configurable filtering. */ import { Message } from 'discord.js'; import { BaseGateway } from './base-gateway.js'; import type { DiscordGatewayConfig, DiscordGuildConfig, DiscordChannelConfig } from './types.js'; import type { MessageRouter } from './message-router.js'; import type { MultiAgentConfig } from '../cli/config/types.js'; import type { MultiAgentRuntimeOptions } from '../multi-agent/types.js'; import { MultiAgentDiscordHandler } from '../multi-agent/multi-agent-discord.js'; /** * Discord Gateway options */ export interface DiscordGatewayOptions { /** Discord bot token */ token: string; /** Message router for processing messages */ messageRouter: MessageRouter; /** Default channel ID for fallback message/file sends */ defaultChannelId?: string; /** Gateway configuration */ config?: Partial; /** Multi-agent configuration (optional) */ multiAgentConfig?: MultiAgentConfig; /** Multi-agent runtime backend options (optional) */ multiAgentRuntime?: MultiAgentRuntimeOptions; } /** * Discord Gateway class * * Connects to Discord via bot token and routes messages * to the MessageRouter for processing. */ export declare class DiscordGateway extends BaseGateway { readonly source: "discord"; private client; private token; private config; private defaultChannelId?; private lastEditTime; private pendingEdit; private editTimer; private multiAgentHandler; private multiAgentRuntime?; protected get mentionPattern(): RegExp | null; constructor(options: DiscordGatewayOptions); /** * Set up Discord client event listeners */ private setupEventListeners; /** * Handle incoming Discord message */ private handleMessage; /** * Classify message type and handle multi-agent bot messages. * Returns null if the message was fully handled (bot-to-bot routing) * or should be ignored, or classification info for further processing. */ private classifyMessage; /** * Collect attachments from message, record to history, and resolve effective attachments. */ private collectAttachments; /** * Dispatch message to multi-agent or single-agent processing. */ private dispatchToAgent; /** * Check if bot should respond to this message */ private shouldRespond; /** * Clean message content (remove mentions) */ protected cleanMessageContent(content: string): string; /** * Edit message with 150ms throttle to respect Discord rate limits */ editMessageThrottled(message: Message, content: string): Promise; /** * Flush pending edit to Discord */ private flushEdit; /** * Send response to Discord (handling length limits and file attachments) */ private sendResponse; /** * Get human-readable channel name for session display */ private getChannelDisplayName; /** * Backfill channel names for existing sessions when Discord connects * This updates sessions created before the channel_name feature was added */ private backfillChannelNames; /** * Start the Discord gateway */ start(): Promise; /** * Stop the Discord gateway */ stop(): Promise; /** * Update gateway configuration */ setConfig(config: Partial): void; /** * Get current configuration */ getConfig(): DiscordGatewayConfig; /** * Add guild configuration */ addGuildConfig(guildId: string, config: DiscordGuildConfig): void; /** * Add channel configuration */ addChannelConfig(guildId: string, channelId: string, config: DiscordChannelConfig): void; private resolveSendChannel; /** * Send a message to a specific channel */ sendMessage(channelId: string, content: string): Promise; /** * Send a file (image, document, etc.) to a specific channel */ sendFile(channelId: string, filePath: string, caption?: string): Promise; /** * Send an image file to a specific channel (alias for sendFile) * @deprecated Use sendFile instead */ sendImage(channelId: string, imagePath: string, caption?: string): Promise; /** * Get the multi-agent handler (if enabled) */ getMultiAgentHandler(): MultiAgentDiscordHandler | null; /** * Update multi-agent configuration */ setMultiAgentConfig(config: MultiAgentConfig): Promise; } //# sourceMappingURL=discord.d.ts.map