Next-Downloader-Bot
A Telegram bot for downloading TikTok videos and images without watermarks. Built with TypeScript, Grammy.js, and Redis for caching.
🚀 Features
- TikTok Video Download: Download TikTok videos without watermarks
- Image Support: Download TikTok image collections
- Caching: Redis-based caching to avoid re-downloading the same content
- Rate Limiting: Built-in rate limiting to prevent abuse
- Internationalization: Multi-language support (English, Russian)
- Docker Support: Easy deployment with Docker Compose
- TypeScript: Fully typed codebase for better development experience
📋 Prerequisites
- Node.js >= 18
- pnpm >= 9.15.9
- Redis server
- Telegram Bot Token
🛠️ Installation
1. Clone the repository
git clone https://github.com/yourusername/next-downloader-bot.git
cd next-downloader-bot
2. Install dependencies
pnpm install
3. Environment Setup
Create a .env file in the root directory:
# Telegram Bot Configuration
BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_API_ROOT=https://api.telegram.org
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password_here
# Rate Limiting (optional, default: 5000ms)
RATE_LIMIT=5000
4. Development
# Start development mode
pnpm dev
# Build the project
pnpm build
# Start production mode
pnpm start
🐳 Docker Deployment
Quick Start with Docker Compose
- Create your
.envfile with the required environment variables - Run the application:
docker-compose up -d
This will start:
- Redis server with password protection
- Telegram Bot API server
- Next-Downloader-Bot application
Automated Releases
This project uses release-please for automated releases based on conventional commits. The process automatically:
- Creates release pull requests when conventional commits are pushed
- Generates semantic version tags when PRs are merged
- Builds and deploys Docker images with proper versioning
Docker Image Tags
The bot uses semantic versioning for Docker image tags. Each deployment creates multiple tags:
latest- Always points to the most recent build{version}- Full semantic version (e.g.,1.0.0){major}.{minor}- Minor version (e.g.,1.0){major}- Major version (e.g.,1)
To use a specific tag, set the BOT_IMAGE_TAG environment variable:
# Use a specific version
export BOT_IMAGE_TAG=1.0.0
docker-compose up -d
# Use latest (default)
docker-compose up -d
For detailed deployment information, see DEPLOYMENT.md.
Development with Docker
For development, use the development compose file:
docker-compose -f docker-compose.dev.yml up -d
📱 Usage
- Start a conversation with your bot on Telegram
- Send a TikTok video or image URL
- The bot will download and send you the content without watermarks
Supported URL Formats
- TikTok video URLs:
https://www.tiktok.com/@username/video/1234567890 - TikTok image URLs:
https://www.tiktok.com/@username/photo/1234567890 - Short TikTok URLs:
https://vt.tiktok.com/ZSHs35NpuL1nt-mE2tD
🏗️ Project Structure
Next-Downloader-Bot/
├── apps/
│ └── bot/ # Main bot application
│ ├── src/
│ │ ├── bot/ # Bot logic and handlers
│ │ ├── config/ # Configuration files
│ │ ├── utils/ # Utility functions
│ │ └── index.ts # Entry point
│ ├── locales/ # Internationalization files
│ └── package.json
├── packages/ # Shared packages
│ ├── eslint-config/ # ESLint configuration
│ ├── typescript-config/ # TypeScript configuration
│ └── lint-staged-config/ # Lint-staged configuration
├── docker-compose.yml # Production Docker setup
├── docker-compose.dev.yml # Development Docker setup
└── package.json
🔧 Configuration
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
BOT_TOKEN |
Telegram bot token from @BotFather | ✅ | - |
TELEGRAM_API_ROOT |
Telegram API root URL | ✅ | - |
REDIS_HOST |
Redis server host | ❌ | redis |
REDIS_PORT |
Redis server port | ❌ | 6379 |
REDIS_PASSWORD |
Redis server password | ✅ | - |
RATE_LIMIT |
Rate limit in milliseconds | ❌ | 5000 |
BOT_IMAGE_TAG |
Docker image tag for the bot | ❌ | latest |
Redis Configuration
The bot uses Redis for caching downloaded videos to avoid re-downloading the same content. Make sure Redis is properly configured with:
- Password protection enabled
- Sufficient memory for caching
- Proper TTL settings
🧪 Development
Available Scripts
# Install dependencies
pnpm install
# Development mode
pnpm dev
# Build the project
pnpm build
# Start production
pnpm start
# Lint code
pnpm lint
# Format code
pnpm format
# Run tests
pnpm test:unit
pnpm test:e2e
Code Quality
The project uses:
- ESLint for code linting
- Prettier for code formatting
- TypeScript for type safety
- Husky for git hooks
- Lint-staged for pre-commit checks
🌐 Internationalization
The bot supports multiple languages. Language files are located in apps/bot/locales/:
en.ftl- Englishru.ftl- Russian
To add a new language:
- Create a new
.ftlfile in the locales directory - Add the language to the bot configuration
- Update the language detection logic
📊 Monitoring
The bot includes comprehensive logging using Pino:
- Request/response logging
- Error tracking
- Performance monitoring
- Rate limit tracking
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
⚠️ Disclaimer
This bot is for educational purposes only. Please respect TikTok's terms of service and copyright laws. Users are responsible for ensuring they have the right to download and use the content.
🆘 Support
If you encounter any issues:
- Check the Issues page
- Create a new issue with detailed information
- Include logs and error messages