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.
- Slash command integration: Use
/issueto 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
- Node.js (version 18 or higher)
- npm or yarn
- Discord application/bot token
- GitHub personal access token
- GitHub repository for issues
-
Clone the repository
git clone https://github.com/sumajoo/discord-github-bot.git cd discord-github-bot -
Install dependencies
npm install
-
Configure environment variables
Create a
.envfile 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
-
Register slash commands
node src/deploy-commands.js
-
Start the bot
node src/index.js
- Visit the Discord Developer Portal
- Create a new application
- Go to "Bot" and create a bot
- Copy the bot token for
DISCORD_TOKEN - Copy the application ID for
APPLICATION_ID - Invite the bot to your server with the following permissions:
applications.commands(slash commands)bot
- Go to GitHub Settings > Developer settings > Personal access tokens
- Create a new token (classic) with these scopes:
repo(for private repositories)public_repo(for public repositories)
- Copy the token for
GITHUB_TOKEN
Set GITHUB_REPO to the format username/repository-name (e.g., sumajoo/discord-github-bot)
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 issuedescription(optional): Detailed description of the problem or feature
After successful creation, you'll receive a response like:
✅ Issue created: https://github.com/username/repository/issues/123
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
To automatically reload the bot during development, consider using a tool like nodemon:
npx nodemon src/index.jsCreates a new GitHub issue.
Options:
title(string, required): Issue titledescription(string, optional): Issue description
Example:
/issue title:"Feature Request: Dark Mode" description:"Would like to have a dark mode for the application"
- 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)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a pull request
This project is licensed under the ISC license.
- Keep tokens safe: Never commit tokens to Git
- Minimum permissions: Create GitHub tokens with only the permissions you need
- Environment variables: Always use
.envfor sensitive data
If you encounter issues or have questions, contact sumajoo or open an issue in this repository.
Made with ❤️ from Vienna