Skip to main content
Glama

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
NameRequiredDescriptionDefault
channel_idYesChannel ID containing the message
message_idYesID of message to moderate
reasonYesReason for moderation
timeout_minutesNoOptional timeout duration in minutes

Implementation Reference

  • 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." )]
  • 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"] } ),

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/hanweg/mcp-discord'

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