-
Notifications
You must be signed in to change notification settings - Fork 0
Development Setup
Garot Conklin edited this page Dec 8, 2024
·
1 revision
This guide provides step-by-step instructions for setting up the fleXRPL Discord Bot development environment.
- Python 3.11+
- Git
- Docker (optional, for containerized development)
- ngrok (for local webhook testing)
- GitHub Account
- Discord Developer Account
- Railway.app Account (for deployment)
git clone https://github.com/fleXRPL/flexrpl-discord-bot.git
cd flexrpl-discord-bot# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Unix/macOS:
source venv/bin/activate
# On Windows:
.\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt# Copy example environment file
cp .env.example .env
# Edit .env with your configuration:
DISCORD_BOT_TOKEN=your_bot_token
GITHUB_WEBHOOK_SECRET=your_webhook_secret
ENVIRONMENT=development- Visit Discord Developer Portal
- Click "New Application"
- Configure basic settings:
- Name: fleXRPL Bot (Dev)
- Description: Development instance of fleXRPL Bot
- Icon: Upload bot avatar
- Navigate to "Bot" section
- Click "Add Bot"
- Configure bot settings:
- Public Bot: Disabled (during development)
- Presence Intent: Enabled
- Server Members Intent: Enabled
- Message Content Intent: Enabled
- Click "Reset Token"
- Copy token to
.envfile:DISCORD_BOT_TOKEN=your_token_here
# Install development tools
pip install black flake8 isort pytest pytest-asyncio pytest-cov
# Format code
black .
# Sort imports
isort .
# Run linter
flake8# Install pre-commit
pip install pre-commit
# Install git hooks
pre-commit install# Create test configuration
cp tests/config.example.py tests/config.py
# Edit test configuration with test bot token and test guild ID# Run all tests
pytest
# Run with coverage
pytest --cov=src
# Run specific test file
pytest tests/test_bot.py# Start the bot
python src/bot/main.py# Start ngrok
ngrok http 8000
# Configure GitHub webhook with ngrok URL{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}- Enable Black formatter
- Configure Flake8 linter
- Set up pytest as test runner
# Build development container
docker build -f Dockerfile.dev -t flexrpl-bot-dev .
# Run container
docker run -it --env-file .env flexrpl-bot-dev-
Bot Token Issues
- Verify token in
.env - Check Discord Developer Portal
- Regenerate token if needed
- Verify token in
-
Dependency Conflicts
- Clear virtual environment
- Reinstall dependencies
- Check version compatibility
-
Permission Issues
- Verify bot permissions
- Check Discord server roles
- Review OAuth2 scopes
- Create feature branch
- Write tests first
- Implement feature
- Run quality checks
- Submit pull request
# Create feature branch
git checkout -b feature/new-feature
# Make changes and commit
git add .
git commit -m "feat: add new feature"
# Push changes
git push origin feature/new-featureThis documentation is maintained by the fleXRP team.