Octopull is a lightweight and efficient Discord bot written in Rust. Designed to integrate seamlessly with Discord servers, it provides a simple and robust way to monitor GitHub repositories in real-time, empowering teams to stay updated on the latest changes in their projects.
- 📦 Repository Tracking: Users can set and query the status of GitHub repositories.
- 🔔 Real-Time Notifications: Automated alerts for new commits every 60 seconds.
- 💬 User Commands:
!setrepo <url>: Define the repository to track.!github: Display general information about the current repository.!commit: Fetch and display the latest commit details.
- 🔄 Concurrent Monitoring: Efficient asynchronous operations using Tokio for periodic checks without blocking user commands.
- Serenity: A framework for building Discord bots.
- Reqwest: For handling HTTP requests to GitHub's REST API.
- Serde: Serialization and deserialization of JSON responses.
- Tokio: An asynchronous runtime for efficient concurrency.
- GitHub REST API: Fetch repository and commit data.
- Discord API: Power the bot's interaction with servers.
- Users configure the repository URL via the
!setrepocommand. - The bot queries GitHub's API to fetch repository or commit information.
- A background task checks the repository for updates every 60 seconds.
- Notifications about new commits are automatically sent to a specified Discord channel.
- Rust (Latest stable version): Install Rust
- A Discord Developer Account: Create a bot token from the Discord Developer Portal.
- A GitHub Token: Generate a personal access token with the
reposcope from GitHub.
-
Clone the Repository
git clone https://github.com/yourusername/octopull.git cd octopull -
Set Up Environment Variables Create a
.envfile based on the providedenv.example:DISCORD_TOKEN=your_discord_bot_token_here DISCORD_CHANNEL_ID=your_discord_channel_id_here GITHUB_TOKEN=your_github_api_token_here REPO_URL=https://api.github.com/repos/your_user/your_repo
- DISCORD_TOKEN: Obtain your bot token from the Discord Developer Portal.
- DISCORD_CHANNEL_ID: Enable Developer Mode in Discord, right-click a channel, and copy its ID.
- GITHUB_TOKEN: Generate from GitHub Settings.
-
Build and Run the Bot
cargo build --release cargo run
-
Invite the Bot to Your Server Use the OAuth2 URL from the Discord Developer Portal to invite your bot:
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=BOT_PERMISSIONS&scope=bot
!ping: Responds with "Pong!" to verify the bot is online.!setrepo <url>: Set the repository URL for monitoring.!github: Fetch general information about the current repository.!commit: Display the latest commit's details.
The bot utilizes Tokio to:
- Manage asynchronous tasks, ensuring the bot remains responsive to user commands while running background checks.
- Periodically check the GitHub API every 60 seconds to detect new commits, without blocking other bot operations.
This project is licensed under the BSD-3 Clause License. See the LICENSE file for details.
Contributions are welcome! Follow these steps:
-
Fork the Repository
git checkout -b feature/your-feature
-
Implement Your Changes
-
Commit and Push
git push origin feature/your-feature
-
Open a Pull Request
- Webhook Integration: Add support for GitHub webhooks for instant notifications.
- Customizable Intervals: Allow users to define the monitoring frequency.
- Advanced Analytics: Display repository statistics and trends over time.
