moderate_message
Delete specific Discord messages and optionally apply timeouts to users, ensuring moderation compliance and maintaining server standards.
Instructions
Delete a message and optionally timeout the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | Channel ID containing the message | |
| message_id | Yes | ID of message to moderate | |
| reason | Yes | Reason for moderation | |
| timeout_minutes | No | Optional timeout duration in minutes |
Implementation Reference
- src/discord_mcp/server.py:433-458 (handler)Handler that fetches the message, deletes it with the given reason, and optionally times out the message author for the specified number of minutes.elif name == "moderate_message": channel = await discord_client.fetch_channel(int(arguments["channel_id"])) message = await channel.fetch_message(int(arguments["message_id"])) # Delete the message await message.delete(reason=arguments["reason"]) # Handle timeout if specified if "timeout_minutes" in arguments and arguments["timeout_minutes"] > 0: if isinstance(message.author, discord.Member): duration = discord.utils.utcnow() + datetime.timedelta( minutes=arguments["timeout_minutes"] ) await message.author.timeout( duration, reason=arguments["reason"] ) return [TextContent( type="text", text=f"Message deleted and user timed out for {arguments['timeout_minutes']} minutes." )] return [TextContent( type="text", text="Message deleted successfully." )]
- src/discord_mcp/server.py:327-354 (registration)Registers the 'moderate_message' tool in the list_tools() handler, including its description and input schema definition.Tool( name="moderate_message", description="Delete a message and optionally timeout the user", inputSchema={ "type": "object", "properties": { "channel_id": { "type": "string", "description": "Channel ID containing the message" }, "message_id": { "type": "string", "description": "ID of message to moderate" }, "reason": { "type": "string", "description": "Reason for moderation" }, "timeout_minutes": { "type": "number", "description": "Optional timeout duration in minutes", "minimum": 0, "maximum": 40320 # Max 4 weeks } }, "required": ["channel_id", "message_id", "reason"] } ),