Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord GitHub Bot

A Discord bot that allows you to create GitHub issues directly from Discord. Users can quickly create issues in a GitHub repository using the /issue slash command.

🚀 Features

  • Slash command integration: Use /issue to create GitHub issues
  • Automatic linking: Issues are automatically associated with the Discord user profile
  • Ephemeral responses: Only the user sees the bot's replies
  • Error handling: Robust error handling with user-friendly messages

📋 Prerequisites

  • Node.js (version 18 or higher)
  • npm or yarn
  • Discord application/bot token
  • GitHub personal access token
  • GitHub repository for issues

🛠️ Installation

  1. Clone the repository

    git clone https://github.com/sumajoo/discord-github-bot.git
    cd discord-github-bot
  2. Install dependencies

    npm install
  3. Configure environment variables

    Create a .env file in the root directory:

    DISCORD_TOKEN=your_discord_bot_token
    APPLICATION_ID=your_discord_application_id
    GITHUB_TOKEN=your_github_personal_access_token
    GITHUB_REPO=username/repository-name
  4. Register slash commands

    node src/deploy-commands.js
  5. Start the bot

    node src/index.js

⚙️ Configuration

Discord Bot Setup

  1. Visit the Discord Developer Portal
  2. Create a new application
  3. Go to "Bot" and create a bot
  4. Copy the bot token for DISCORD_TOKEN
  5. Copy the application ID for APPLICATION_ID
  6. Invite the bot to your server with the following permissions:
    • applications.commands (slash commands)
    • bot

GitHub Token Setup

  1. Go to GitHub Settings > Developer settings > Personal access tokens
  2. Create a new token (classic) with these scopes:
    • repo (for private repositories)
    • public_repo (for public repositories)
  3. Copy the token for GITHUB_TOKEN

Repository Configuration

Set GITHUB_REPO to the format username/repository-name (e.g., sumajoo/discord-github-bot)

📖 Usage

Create an issue

Use the /issue slash command in Discord:

/issue title:"Bug: Button does not work" description:"The submit button on the homepage doesn't respond to clicks. Browser: Chrome 120"

Parameters:

  • title (required): A meaningful title for the issue
  • description (optional): Detailed description of the problem or feature

Example output

After successful creation, you'll receive a response like:

✅ Issue created: https://github.com/username/repository/issues/123

🏗️ Project structure

discord-github-bot/
├── src/
│   ├── deploy-commands.js    # Register slash commands
│   └── index.js             # Main bot logic
├── package.json
├── jsconfig.json
├── .env                     # Environment variables (not in Git)
└── README.md

🔧 Development

To automatically reload the bot during development, consider using a tool like nodemon:

npx nodemon src/index.js

📝 Commands

/issue

Creates a new GitHub issue.

Options:

  • title (string, required): Issue title
  • description (string, optional): Issue description

Example:

/issue title:"Feature Request: Dark Mode" description:"Would like to have a dark mode for the application"

🚨 Error handling

  • If an error occurs, a user-friendly message is displayed
  • Detailed errors are logged to the console
  • The bot only replies ephemerally (visible only to the user)

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a pull request

📄 License

This project is licensed under the ISC license.

🔐 Security

  • Keep tokens safe: Never commit tokens to Git
  • Minimum permissions: Create GitHub tokens with only the permissions you need
  • Environment variables: Always use .env for sensitive data

📞 Support

If you encounter issues or have questions, contact sumajoo or open an issue in this repository.


Made with ❤️ from Vienna

About

Create GitHub issues directly from Discord.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages