id: discord
name: Discord
version: 1.0.0
description: "Discord — SOC alerting and ChatOps: post messages via an incoming webhook, and (with a bot token) send channel messages, read recent channel messages, and get channel info. Webhook + bot-token authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: webhook message, bot channel message, list channel messages, get channel."
category: notification

# Per-instance configuration. webhook_url is used by the simple message command;
# bot_token (sent as 'Authorization: Bot <token>') is used by the channel commands.
config_schema:
  properties:
    webhook_url:
      type: string
      description: "Discord channel webhook URL (for webhook-message)"
      x-soar-sensitive: true
    bot_token:
      type: string
      description: "Bot token (for channel API commands)"
      x-soar-sensitive: true
  required: []

commands:
  - id: send_webhook_message
    name: discord-send-webhook-message
    description: "Post a message via the configured incoming webhook."
    inputs_schema:
      properties:
        content: { type: string, description: "Message text" }
        username: { type: string, description: "Override the webhook display name (optional)" }
      required: [content]
    outputs_schema: { properties: {} }
  - id: send_channel_message
    name: discord-send-channel-message
    description: "Send a message to a channel using the bot token."
    inputs_schema:
      properties:
        channel_id: { type: string, description: "Channel ID" }
        content: { type: string, description: "Message text" }
      required: [channel_id, content]
    outputs_schema: { properties: {} }
  - id: list_channel_messages
    name: discord-list-channel-messages
    description: "List recent messages in a channel (bot token)."
    risk: read
    inputs_schema:
      properties:
        channel_id: { type: string, description: "Channel ID" }
        limit: { type: number, description: "Max messages (default 20)" }
      required: [channel_id]
    outputs_schema: { properties: {} }
  - id: get_channel
    name: discord-get-channel
    description: "Get a channel's info (bot token)."
    risk: read
    inputs_schema:
      properties:
        channel_id: { type: string, description: "Channel ID" }
      required: [channel_id]
    outputs_schema: { properties: {} }

  - id: test_connection
    name: discord-test-connection
    description: "Verify the bot token (used by the Test button)."
    risk: read
    inputs_schema:
      properties: {}
      required: []
    outputs_schema: { properties: {} }
