Show HN: Simple bot to create GitHub issues from Discord messages

4 months ago 11

This bot integrates Discord with GitHub, allowing users to manage GitHub issues directly from Discord.

Credits:

  1. Forked from https://github.com/holmityd/GitHub-Issues-Discord-Threads-Bot
  2. Cursor + Gemini-2.5-pro

The primary command is /github, which has several subcommands:

  • /github issue_create title: <title> [description: <description>] [labels: <label1,label2>]: Creates a new GitHub issue.
    • title: (Required) The title of the issue.
    • description: (Optional) The description for the issue.
    • labels: (Optional) Comma-separated list of labels to add to the issue (e.g., bug,enhancement). The label discord-bot is automatically added.
  • /github issue_comment issue_ref: <issue_number_or_url> comment: <comment_text>: Adds a comment to an existing GitHub issue.
    • issue_ref: (Required) The GitHub issue number or its full URL.
    • comment: (Required) The text of the comment to add.
  • /github issue_get issue_ref: <issue_number_or_url>: Fetches and displays details of a specific GitHub issue.
    • issue_ref: (Required) The GitHub issue number or its full URL.
  • /github issue_label issue_ref: <issue_number_or_url> action: <add|remove> labels: <label1,label2>: Adds or removes labels from a GitHub issue.
    • issue_ref: (Required) The GitHub issue number or its full URL.
    • action: (Required) Whether to add or remove labels.
    • labels: (Required) Comma-separated list of labels.
  • /github help: Displays a list of all available GitHub commands and their usage.

Context Menu Commands (Right-click on a message -> Apps)

  • Create GitHub Issue from Message: Opens a modal pre-filled with the selected message content (including images) to create a new GitHub issue. You can specify the title, description (auto-filled from message), and labels.
  • Add to GitHub Issue as Comment: Opens a modal to add the selected message content (including images) as a comment to an existing GitHub issue. You'll need to provide the issue number or URL.
  1. Clone the repository:

    git clone https://github.com/your-username/ultimate-github-discord-bot.git cd ultimate-github-discord-bot
  2. Install dependencies:

  3. Configuration:

    • Create a .env file in the root directory by copying the example:
    • Fill in the required environment variables in the .env file:
      • DISCORD_TOKEN: Your Discord bot token.
        1. Go to the Discord Developer Portal.
        2. Select your application.
        3. Navigate to the "Bot" page.
        4. Click "Reset Token" (or "View Token" if visible) and copy the token.
      • DISCORD_CLIENT_ID: Your Discord application's client ID.
        1. In the Discord Developer Portal, on your application's "General Information" page, you can find the "APPLICATION ID". Copy this ID.
      • DISCORD_GUILD_ID: The ID of the Discord server (guild) where you want to deploy and test the slash commands.
        1. In Discord, enable User Settings -> Advanced -> Developer Mode.
        2. Right-click on your server icon on the left-hand side and select "Copy ID".
      • DISCORD_CHANNEL_ID: The ID of a specific channel in your Discord server that the bot might use (e.g., for logging or specific interactions, though its direct use isn't apparent in the primary commands, it's in the config).
        1. With Developer Mode enabled, right-click on the desired channel in your server and select "Copy ID".
      • GITHUB_ACCESS_TOKEN: Your GitHub personal access token.
        1. Go to GitHub -> Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens.
        2. Click "Generate new token".
        3. Give it a name, set an expiration.
        4. Under "Repository access", select "Only select repositories" and choose the target repository.
        5. Under "Permissions", go to "Repository permissions" and set "Issues" to "Read & Write". You might also need "Contents" set to "Read-only" if the bot needs to read file information, or "Pull requests" to "Read & Write" if it manages PRs (though current features focus on issues). For current functionality, "Issues: Read & Write" is the primary one.
        6. Click "Generate token" and copy it.
      • GITHUB_USERNAME: The owner of the GitHub repository (e.g., your GitHub username or organization name).
      • GITHUB_REPOSITORY: The name of the GitHub repository.
  4. Deploy Slash Commands (Development/First Run): The bot will attempt to deploy/update slash commands on startup if DISCORD_CLIENT_ID and DISCORD_GUILD_ID are set. For production, you might run this as a separate step.

  5. Run the bot:

    Or for development with auto-reloading:

  • The bot is built with TypeScript.
  • Source code is in the src directory.
  • Ensure you have Node.js and npm installed.

Contributions are welcome! Please open an issue or submit a pull request.

Read Entire Article