discord_edit_message
Edit existing Discord messages by providing channel ID, message ID, and new content to update text in Discord channels.
Instructions
Edit a previously sent message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The Discord channel ID | |
| messageId | Yes | The message ID to edit | |
| content | Yes | New message content |
Implementation Reference
- src/core/AutomationManager.ts:61-64 (handler)The core handler function for the 'discord_edit_message' tool. It validates the input parameters using the EditMessageSchema and delegates the actual Discord API call to DiscordService.editMessage.async editMessage(channelId: string, messageId: string, newMessage: string): Promise<string> { const parsed = schemas.EditMessageSchema.parse({ channelId, messageId, newMessage }); return await this.discordService.editMessage(parsed.channelId, parsed.messageId, parsed.newMessage); }
- src/types.ts:28-32 (schema)Zod schema that defines and validates the input parameters for the 'discord_edit_message' tool: channelId, messageId, newMessage.export const EditMessageSchema = z.object({ channelId: z.string().describe("Discord channel ID"), messageId: z.string().describe("Specific message ID"), newMessage: z.string().describe("New message content") });
- src/core/DiscordController.ts:69-80 (registration)Dynamic registration/dispatch mechanism that converts snake_case action names (e.g., 'edit_message' or 'discord_edit_message') to camelCase method names on AutomationManager and invokes them.private async callAutomationMethod(action: string, params: any): Promise<string> { // Convert action name to method name (snake_case to camelCase) const methodName = action.replace(/_([a-z])/g, (g) => g[1].toUpperCase()); // Check if method exists if (typeof (this.automationManager as any)[methodName] === 'function') { // Call the method with params return await (this.automationManager as any)[methodName](...Object.values(params)); } throw new Error(`Method '${methodName}' not found in AutomationManager`); }
- src/core/DiscordController.ts:43-67 (registration)Entry point for executing tools/actions, including permission checks via ConfigManager, logging, rate limiting, and delegation to specific handlers via callAutomationMethod.async executeAction(action: string, params: any): Promise<string> { try { // Check if action is allowed if (!this.configManager.isActionAllowed(action)) { throw ErrorHandler.createPermissionError(`Action '${action}' is not allowed`); } // Log the operation this.logger.logOperation(action, params); // Wait for rate limits if needed if (this.configManager.getConfig().rateLimitProtection) { await this.rateLimiter.waitForRateLimit(action); } // Execute the action using reflection-like approach const result = await this.callAutomationMethod(action, params); this.logger.info(`Action '${action}' executed successfully`); return result; } catch (error) { this.logger.logError(`Action '${action}' failed`, error); ErrorHandler.handle(error); } }