Skip to content

feat: Discord Integration #7

@research-developer

Description

@research-developer

Overview

Add Discord bot integration for notifications and slash commands.

Interaction Webhooks ✅

Discord uses HTTP interactions (not WebSocket required):

Interaction Types

  • 1 - PING (verification)
  • 2 - APPLICATION_COMMAND (slash commands)
  • 3 - MESSAGE_COMPONENT (buttons, selects)
  • 4 - APPLICATION_COMMAND_AUTOCOMPLETE
  • 5 - MODAL_SUBMIT

Identification

  • Header: X-Signature-Ed25519 (Ed25519 signature)
  • Header: X-Signature-Timestamp
  • Payload: Contains type, application_id, guild_id

Signature Verification (Ed25519)

from nacl.signing import VerifyKey
verify_key = VerifyKey(bytes.fromhex(public_key))
message = timestamp.encode() + body
verify_key.verify(message, bytes.fromhex(signature))

Interaction Payload

{
  "type": 2,
  "id": "interaction_id",
  "application_id": "app_id",
  "guild_id": "server_id",
  "channel_id": "channel_id",
  "member": {
    "user": { "id": "user_id", "username": "user" }
  },
  "data": {
    "name": "review",
    "options": [{ "name": "url", "value": "https://..." }]
  }
}

Tasks

  • Add Discord interaction handler
  • Implement slash commands (/review, /describe, /ask)
  • Ed25519 signature verification
  • Send PR notifications to Discord channels
  • Embed-rich PR summaries
  • Button interactions for quick actions

Use Cases

  1. Notifications: Alert channel when PR opens/updates
  2. Commands: /review <pr_url> from Discord
  3. Rich Embeds: Formatted PR summaries with status
  4. Buttons: Approve/request changes via buttons

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions