This project is a Discord bot that monitors GitHub activity and posts updates to a specified Discord channel. It uses the GitHub API to fetch the latest events and formats them into rich embeds using Discord.js.
- Monitors GitHub user activity and posts updates to a Discord channel.
- Includes detailed information about events such as pushes and pull requests.
- Periodically checks for new activity every minute.
- Supports slash commands, like
/ping, to interact with the bot.
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- A Discord bot token
- A GitHub personal access token
-
Clone the repository:
git clone https://github.com/your-username/github-activity-discord-bot.git cd github-activity-discord-bot -
Install dependencies:
npm install
-
Configure environment variables:
fill in your credentials:
DISCORD_TOKEN=your_discord_bot_token GITHUB_TOKEN=your_github_personal_access_token GITHUB_USERNAME=your_github_username CHANNEL_ID=your_discord_channel_id -
Run the bot:
node index.js
Once the bot is running, it will:
- Post GitHub activity updates to the specified Discord channel.
- Respond to the
/pingcommand with the bot's latency.
- Responds with the bot's WebSocket latency.
index.js: Main entry point for the bot.updateGitHubActivity(): Fetches the latest GitHub activity and posts updates to Discord.getGitHubActivity(): Fetches user events from the GitHub API.formatActivityEmbed(): Formats a GitHub event into a Discord embed.getRepoContributors(): Fetches contributors of a repository from the GitHub API.
- Make sure to keep your tokens secure and do not expose them publicly.
- Adjust the
setIntervalduration inupdateGitHubActivity()to change the frequency of activity checks.
Feel free to submit issues and pull requests to help improve this project. Contributions are always welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
