quick-zip-bot
quick-zip-bot copied to clipboard
Minimalist Telegram bot to zip files.
quick-zip-bot
Minimalist Telegram bot to zip files.
Features
-
Full async, not blocking I/O.
-
Concurrent download and zipping of files.
Usage
- Send the command
/add, this notifies the bot that you are going to send some files to zip in a single file. - Send the files (photos, videos, documents, etc.) you want to add, total size must not exceed 1.95 GB.
- Send
/zip <filename>command where filename (admitted characters: A-Za-z0-9_) is the name of the zip you want to get. Ex:/zip summer_photoswill create a zip file with namesummer_photos.zip.
Send /cancel instead of /zip if you want to finish the process and not create the zip file.
Deployment
Environment Variables
You need to define the environment variables required for the bot to work. Where or how to define them depends on the method used to run the bot. You can use locally an .env file like .env.example.
| Variable | Required | Description |
|---|---|---|
API_ID |
yes | Your personal Telegram API ID from https://my.telegram.org. |
API_HASH |
yes | Your personal Telegram API hash from https://my.telegram.org. |
BOT_TOKEN |
yes | The token of your bot created with @botfather. |
CONC_MAX |
default=3 | Max amount of files to be downloaded concurrently. |
Locally
Create a virtual environment to install the dependencies isolated of other projects you are working on.
$ python -m venv env
$ source env/bin/activate
Install the dependencies and run the bot.
$ pip install -r requirements.txt
$ python src/bot.py
Docker
Build the image with the provided Dockerfile.
$ docker image build -t quick-zip-bot .
Run the image with your .env file.
$ docker container run -d --name quick-zip-bot --env-file .env quick-zip-bot
Railway
not free anymore
- Fork this repository to your GitHub account, and give it a star :).
- Login or create your Railway account as needed.
- Create a new project on Railway by choosing
GitHub Repooption and selecting the repository you forked on step 1. - Click the new project created and go to
Variablessection, where you must set the environment variables. - You are ready to use the bot when deployment is ready, this may take a bit.
Contribute
I'll be happy to receive any issue or pull request to improve the bot, fell free to contribute.