- Code of Conduct
- Getting Started
- Development Setup
- Contributing Guidelines
- Pull Request Process
- Issue Guidelines
- Code Style
- Testing
- Documentation
- Release Process
This project and everyone participating in it is governed by our commitment to creating a welcoming and inclusive environment. By participating, you agree to:
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on what's best for the community
- Show empathy towards other community members
- Accept constructive criticism gracefully
- Use welcoming and inclusive language
Before you begin, ensure you have:
- Python 3.10+ installed
- Git installed
- Telegram Bot Token (for testing)
- Basic understanding of Python, Pyrogram, and yt-dlp
- Familiarity with Telegram Bot API
- 🐛 Bug fixes and issue resolution
- ✨ New features and enhancements
- 📚 Documentation improvements
- 🧪 Testing and quality assurance
- 🌍 Internationalization (i18n)
- 🎨 UI/UX improvements
- 🔧 Performance optimizations
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/tg-ytdlp-bot.git
cd tg-ytdlp-bot
# Add upstream remote
git remote add upstream https://github.com/chelaxian/tg-ytdlp-bot.git# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install development dependencies
pip install -r requirements-dev.txt # If available# Copy configuration template
cp CONFIG/_config.py CONFIG/config.py
# Edit configuration with your test bot credentials
nano CONFIG/config.py# Run the bot to ensure everything works
python3 magic.pyWhen reporting bugs, please include:
- Clear description of the issue
- Steps to reproduce the problem
- Expected behavior vs actual behavior
- Environment details (OS, Python version, etc.)
- Relevant logs and error messages
- Screenshots if applicable
For new features, please provide:
- Clear description of the proposed feature
- Use case and motivation
- Proposed implementation approach
- Potential impact on existing functionality
- Backward compatibility considerations
- Small, focused changes are preferred
- One feature/fix per pull request
- Follow existing code style and patterns
- Add tests for new functionality
- Update documentation as needed
# Update your fork
git fetch upstream
git checkout main
git merge upstream/main
# Create a new branch for your feature
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Write clean, readable code
- Follow the existing code style
- Add comments for complex logic
- Test your changes thoroughly
# Stage your changes
git add .
# Commit with a descriptive message
git commit -m "Add: New feature for user authentication"
# or
git commit -m "Fix: Resolve issue with video download timeout"Commit Message Format:
Add:for new featuresFix:for bug fixesUpdate:for improvementsRemove:for deletionsRefactor:for code refactoringDocs:for documentation changes
# Push your branch
git push origin feature/your-feature-name
# Create a Pull Request on GitHub- Test your changes thoroughly
- Update documentation if needed
- Add tests for new functionality
- Check code style and formatting
- Ensure no conflicts with main branch
- Update CHANGELOG.md if applicable
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tested locally
- [ ] Added unit tests
- [ ] Tested with real bot
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
## Screenshots (if applicable)
Add screenshots to help explain your changes
## Additional Notes
Any additional information for reviewers- Automated checks must pass
- Code review by maintainers
- Testing by maintainers
- Approval and merge
- Search existing issues to avoid duplicates
- Check if it's already fixed in the latest version
- Gather relevant information about the problem
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
What you expected to happen.
**Screenshots**
If applicable, add screenshots.
**Environment:**
- OS: [e.g. Ubuntu 20.04]
- Python version: [e.g. 3.10.0]
- Bot version: [e.g. 1.0.0]
**Additional context**
Any other context about the problem.**Is your feature request related to a problem?**
A clear description of what the problem is.
**Describe the solution you'd like**
A clear description of what you want to happen.
**Describe alternatives you've considered**
Alternative solutions or features you've considered.
**Additional context**
Any other context or screenshots about the feature request.- Follow PEP 8 guidelines
- Use type hints where appropriate
- Write docstrings for functions and classes
- Use meaningful variable names
- Keep functions small and focused
def download_video(url: str, user_id: int, quality: str = "best") -> bool:
"""
Download video from URL with specified quality.
Args:
url: Video URL to download
user_id: Telegram user ID
quality: Video quality preference
Returns:
bool: True if download successful, False otherwise
Raises:
ValueError: If URL is invalid
ConnectionError: If download fails
"""
if not url or not url.startswith(('http://', 'https://')):
raise ValueError("Invalid URL provided")
try:
# Implementation here
return True
except Exception as e:
logger.error(f"Download failed for user {user_id}: {e}")
return Falsetg-ytdlp-bot/
├── COMMANDS/ # Bot command handlers
├── CONFIG/ # Configuration files
├── DOWN_AND_UP/ # Download and upload logic
├── HELPERS/ # Utility functions
├── URL_PARSERS/ # URL parsing and extraction
├── magic.py # Main bot file
├── requirements.txt # Dependencies
└── README.md # Documentation
- Write tests for new functionality
- Test edge cases and error conditions
- Mock external dependencies when possible
- Test with real data when safe
# Run all tests
python -m pytest
# Run specific test file
python -m pytest tests/test_commands.py
# Run with coverage
python -m pytest --cov=.import pytest
from unittest.mock import Mock, patch
from COMMANDS.args_cmd import get_user_ytdlp_args
class TestArgsCommand:
def test_get_user_ytdlp_args_success(self):
"""Test successful retrieval of user yt-dlp arguments."""
user_id = 12345
url = "https://youtube.com/watch?v=test"
result = get_user_ytdlp_args(user_id, url)
assert isinstance(result, dict)
assert "format" in result
def test_get_user_ytdlp_args_invalid_user(self):
"""Test handling of invalid user ID."""
with pytest.raises(ValueError):
get_user_ytdlp_args(-1, "https://example.com")- Update README.md for user-facing changes
- Add docstrings to new functions and classes
- Update inline comments for complex logic
- Create examples for new features
- User Documentation (README.md)
- API Documentation (docstrings)
- Developer Documentation (this file)
- Configuration Documentation (config comments)
We follow Semantic Versioning:
- MAJOR version for incompatible API changes
- MINOR version for new functionality (backward compatible)
- PATCH version for bug fixes (backward compatible)
- Update version in config files
- Update CHANGELOG.md with new features/fixes
- Run full test suite
- Update documentation
- Create release notes
- Tag release in Git
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Telegram: @tg_ytdlp for community support
- PyroTGFork Documentation: https://telegramplayground.github.io/pyrogram/
- yt-dlp Documentation: https://github.com/yt-dlp/yt-dlp
- Telegram Bot API: https://core.telegram.org/bots/api
Contributors will be recognized in:
- README.md acknowledgments
- Release notes for significant contributions
- GitHub contributors page
By contributing to tg-ytdlp-bot, you agree that your contributions will be licensed under the same license as the project (MIT License).
Thank you for contributing to tg-ytdlp-bot! 🎉
Your contributions help make this project better for everyone. If you have any questions about contributing, please don't hesitate to ask!