A Discord bot for GitHub notifications and repository management for the fleXRPL organization.
- GitHub webhook integration
- Repository event notifications
- Command-based subscription management
- Role-based access control
- Comprehensive logging system
- Secure command handling with deferred responses
/githubsub
- Subscribe to GitHub notifications/help
- Show available commands/ping
- Check bot latency
- Python 3.11+ (updated to match Railway.app environment)
- Discord Developer Account
- GitHub Organization Admin access
- Railway.app Account
.flexrpl-discord-bot/
├── Dockerfile
├── PRIVACY_POLICY.md
├── Procfile
├── README.md
├── TERMS_OF_SERVICE.md
├── app.py
├── config.py
├── format_and_lint.sh
├── requirements-dev.txt
├── requirements.txt
├── runtime.txt
├── setup.cfg
├── src
│ ├── bot
│ │ ├── __init__.py
│ │ ├── bot.py
│ │ ├── commands.py
│ │ └── events.py
│ ├── handlers
│ │ └── github_webhook.py
│ ├── main.py
│ ├── routes
│ │ └── discord.py
│ └── utils
│ └── formatting.py
└── tests
├── conftest.py
├── test_bot.py
├── test_commands.py
├── test_discord_routes.py
├── test_events.py
├── test_formatting.py
└── test_main.py
13 directories, 48 files
- Install development dependencies:
pip install -r requirements-dev.txt
- Install pre-commit hooks:
pre-commit install
- Run tests:
pytest
- Run linting and formatting:
bash format_and_lint.sh
- Clone the repository:
git clone https://github.com/fleXRPL/flexrpl-discord-bot.git
cd flexrpl-discord-bot
- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # Unix
# or
.\venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
pip install -r requirements-dev.txt # for development
- Copy
.env.example
to.env
and configure:
cp .env.example .env
# Edit .env with your configuration
- Run the application:
uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload
Required variables:
DISCORD_PUBLIC_KEY
: Your Discord application public keyDISCORD_APPLICATION_ID
: Your Discord application IDDISCORD_BOT_TOKEN
: Your Discord bot tokenDISCORD_CLIENT_ID
: Your Discord client IDGITHUB_WEBHOOK_SECRET
: Secret for GitHub webhooksPORT
: Port for the application to run on (default: 8000)
Optional variables:
LOG_LEVEL
: Logging level (default: INFO)ALLOWED_GUILD_IDS
: Comma-separated list of allowed Discord server IDsADMIN_USER_IDS
: Comma-separated list of Discord admin user IDs
- Fork this repository
- Create new project on Railway.app
- Connect your GitHub repository
- Add required environment variables in Railway dashboard
- Deploy!
The bot includes comprehensive tests:
# Run all tests
pytest
# Run tests with coverage
pytest --cov=src
# Run specific test file
pytest tests/test_discord_routes.py -v
The bot includes detailed logging for troubleshooting:
- Request/response logging for all interactions
- Command processing logs
- Error tracking with stack traces
- Performance metrics
Please read our Contributing Guidelines before submitting changes.
This project is licensed under the MIT License - see the LICENSE file for details.