Skip to main content
Glama
wowjinxy
by wowjinxy

moderate_message

Delete Discord messages and optionally timeout users to enforce server rules and maintain community standards.

Instructions

Moderate a message by deleting it and optionally timing out the author.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
message_idYes
delete_messageNo
timeout_minutesNo
reasonNo

Implementation Reference

  • The core handler function `handle_moderate_message` that implements the moderation logic: fetches the channel and message, deletes the message with a reason, optionally applies a timeout to the author if they are a member, and returns a formatted confirmation message.
    @staticmethod
    async def handle_moderate_message(discord_client, arguments: Dict[str, Any]) -> List[TextContent]:
        """Delete a message and optionally timeout the user"""
        channel = await discord_client.fetch_channel(int(arguments["channel_id"]))
        message = await channel.fetch_message(int(arguments["message_id"]))
        
        # Get the message author before deletion
        author = message.author
        content_preview = message.content[:50] + "..." if len(message.content) > 50 else message.content
        
        # Delete the message
        await message.delete(reason=arguments["reason"])
        
        result = f"Deleted message from {author.name}: '{content_preview}'\nReason: {arguments['reason']}"
        
        # Apply timeout if specified
        if "timeout_minutes" in arguments and arguments["timeout_minutes"] > 0:
            if isinstance(author, discord.Member):
                timeout_duration = timedelta(minutes=arguments["timeout_minutes"])
                await author.timeout(timeout_duration, reason=arguments["reason"])
                result += f"\nApplied {arguments['timeout_minutes']} minute timeout to {author.name}"
            else:
                result += f"\nCould not timeout {author.name} (user may not be in server)"
        
        return [TextContent(type="text", text=result)]
  • The MCP Tool registration for 'moderate_message', including name, description, and input schema defining parameters: channel_id (required string), message_id (required string), reason (required string), timeout_minutes (optional number 0-40320).
    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
                }
            },
            "required": ["channel_id", "message_id", "reason"]
        }
    ),
  • The input schema for the moderate_message tool, specifying the required and optional parameters with types and descriptions.
        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
                }
            },
            "required": ["channel_id", "message_id", "reason"]
        }
    ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wowjinxy/mcp-discord'

If you have feedback or need assistance with the MCP directory API, please join our Discord server