This repository contains multiple Discord bots designed for various automation tasks, including GitHub monitoring, CI/CD notifications, and interactive features.
/discord_automation
│-- /github_monitor_bot # GitHub monitoring bot (tracks commits, stars, PRs)
│ ├-- bot.py # Main bot script
│ ├-- requirements.txt # Dependencies for this bot
│ ├-- .env # Environment variables (ignored in Git)
│ ├-- bot_data.json # Persistent data storage
│ └-- README.md # Bot-specific documentation
│
│-- /ci_alert_bot # CI/CD monitoring bot
│ ├-- bot.py # Tracks CI/CD build status
│ ├-- requirements.txt
│ ├-- .env
│ └-- README.md
│
│-- /fun_game_bot # A daily game bot for the Discord server
│ ├-- bot.py
│ ├-- requirements.txt
│ ├-- .env
│ └-- README.md
│
│-- /shared # Shared utilities (if needed)
│ └-- utils.py # Helper functions used by multiple bots
│
│-- /scripts # Maintenance scripts (optional)
│ └-- restart_bots.sh # Script to restart all bots
│
│-- README.md # General documentation for all bots
│-- .gitignore # Ignore sensitive files
git clone https://github.com/your-org/discord_automation.git
cd discord_automation
Each bot lives in its own directory. Navigate to the bot you want to set up:
cd github_monitor_bot
Create a virtual environment and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Each bot requires a .env
file for credentials. Example .env
:
DISCORD_BOT_TOKEN=your-bot-token
DISCORD_GITHUB_CHANNEL_ID=your-channel-id
GITHUB_API_TOKEN=your-github-token
GITHUB_ORG=your-organization-name
🚨 Never commit .env
files! This repository includes a .gitignore
rule to prevent that.
Each bot runs independently. Start a bot manually with:
cd github_monitor_bot
source venv/bin/activate
python bot.py
For automatic startup on reboot, use systemd services:
sudo systemctl start github_monitor_bot
To enable startup on boot:
sudo systemctl enable github_monitor_bot
To check the bot's status:
sudo systemctl status github_monitor_bot
You can automate bot management with a script. Example restart_bots.sh
:
#!/bin/bash
source /home/discordbot/discord_automation/github_monitor_bot/venv/bin/activate
python /home/discordbot/discord_automation/github_monitor_bot/bot.py &
source /home/discordbot/discord_automation/ci_alert_bot/venv/bin/activate
python /home/discordbot/discord_automation/ci_alert_bot/bot.py &
Make it executable:
chmod +x restart_bots.sh
Run with:
./restart_bots.sh
- Add more bots for different functionalities.
- Implement logging and error handling.
- Use a single
.env
management system for all bots.
🛠️ Contributions welcome! Fork and improve the bots!
🚀 Neumann's Workshop - Making Automation Smarter!