Welcome to TGDrive! This web application replicates Google Drive's functionalities using Telegram as its storage backend. Manage folders and files, perform actions like uploading, renaming, and deleting, utilize trash/bin support, enable permanent deletion, and share public links. The application offers admin login and automatically backs up the database to Telegram.
Explore the live demo of TGDrive:
Feel free to test the features with the provided login credentials.
| Variable Name | Type | Example | Description |
|---|---|---|---|
API_ID |
integer | 123456 | Your Telegram API ID |
API_HASH |
string | dagsjdhgjfsahgjfh | Your Telegram API Hash |
BOT_TOKENS |
string | 21413535:gkdshajfhjfakhjf | List of Telegram bot tokens for file operations, separated by commas |
STORAGE_CHANNEL |
integer | -100123456789 | Chat ID of the Telegram storage channel |
DATABASE_BACKUP_MSG_ID |
integer | 123 | Message ID of a file in the storage channel for database backups |
Note: All bots mentioned in the
BOT_TOKENSvariable must be added as admins in yourSTORAGE_CHANNEL.
Note:
DATABASE_BACKUP_MSG_IDshould be the message ID of a file (document) in theSTORAGE_CHANNEL.
| Variable Name | Type | Default | Description |
|---|---|---|---|
ADMIN_PASSWORD |
string | admin | Password for accessing the admin panel |
STRING_SESSIONS |
string | None | List of Premium Telegram Account Pyrogram String Sessions for file operations |
SLEEP_THRESHOLD |
integer (in seconds) | 60 | Delay in seconds before retrying after a Telegram API floodwait error |
DATABASE_BACKUP_TIME |
integer (in seconds) | 60 | Interval in seconds for database backups to the storage channel |
MAX_FILE_SIZE |
float (in GBs) | 1.98 (3.98 if STRING_SESSIONS are added) |
Maximum file size (in GBs) allowed for uploading to Telegram |
WEBSITE_URL |
string | None | Website URL (with https/http) to auto-ping to keep the website active |
MAIN_BOT_TOKEN |
string | None | Your Main Bot Token to use TG Drive's Bot Mode |
TELEGRAM_ADMIN_IDS |
string | None | List of Telegram User IDs of admins who can access the bot mode, separated by commas |
Note: Premium Client (
STRING_SESSIONS) will be used only to upload files when file size is greater than 2GB.
Note: File streaming/downloads will be handled by bots (
BOT_TOKENS).
Note: Read more about TG Drive's Bot Mode here.
First, clone the repository and navigate into the project directory:
git clone https://github.com/TechShreyash/TGDrive
cd TGDriveCreate a .env file in the root directory and add the necessary environment variables.
Note: Some hosting services allow you to set environment variables directly through their interface, which may eliminate the need for a
.envfile.
Install the required Python packages:
pip install -U -r requirements.txtStart the TG Drive application using Uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000Build the Docker image:
docker build -t tgdrive .Run the Docker container:
docker run -d -p 8000:8000 tgdriveAccess the application at http://127.0.0.1:8000 or http://your_ip:8000.
Note: For more detailed information on deploying FastAPI applications, refer to online guides and resources.
Deploy To Render.com For Free : https://youtu.be/S5OIi5Ur3c0
Note: After updating the TG Drive code, clear your browser's cache to ensure the latest JavaScript files are loaded and run correctly.
TG Drive's Bot Mode is a new feature that allows you to upload files directly to your TG Drive website from a Telegram bot. Simply send or forward any file to the bot, and it will be uploaded to your TG Drive. You can also specify the folder where you want the files to be uploaded.
To use this feature, you need to set the configuration variables MAIN_BOT_TOKEN and TELEGRAM_ADMIN_IDS. More information about these variables can be found in the optional variables section.
Once these variables are set, users whose IDs are listed in TELEGRAM_ADMIN_IDS will have access to the bot.
/set_folder - Set the folder for file uploads/current_folder - Check the current folderBot Mode - Youtube Video Tutorial : https://youtu.be/XSeY2XcHdGI
/set_folder command and follow the instructions provided by the bot.Stay informed by joining our updates channel on Telegram: @TechZBots. We post updates, guides, and tips about TG Drive there.
Contributions are welcome! Fork the repository, make your changes, and create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For inquiries or support, join our Telegram Support Group or email [email protected].