{"id":21643466,"url":"https://github.com/aigptcode/backup-telegram-with-bot-token","last_synced_at":"2026-03-04T00:02:18.950Z","repository":{"id":253801878,"uuid":"844574238","full_name":"AiGptCode/Backup-telegram-with-bot-token","owner":"AiGptCode","description":"This is a Telegram bot designed to back up messages and media files from Telegram chats to a local file system and a SQLite database. It handles various types of media including photos, videos, documents, voice messages, and more.","archived":false,"fork":false,"pushed_at":"2024-08-20T12:36:14.000Z","size":11,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-25T05:34:29.913Z","etag":null,"topics":["ai","api","bot","bot-father","hack","llm","telegram","token"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AiGptCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T14:32:27.000Z","updated_at":"2024-11-19T22:52:12.000Z","dependencies_parsed_at":"2024-08-19T17:19:38.715Z","dependency_job_id":null,"html_url":"https://github.com/AiGptCode/Backup-telegram-with-bot-token","commit_stats":null,"previous_names":["aigptcode/backup-telegram-with-bot-token"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiGptCode%2FBackup-telegram-with-bot-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiGptCode%2FBackup-telegram-with-bot-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiGptCode%2FBackup-telegram-with-bot-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AiGptCode%2FBackup-telegram-with-bot-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AiGptCode","download_url":"https://codeload.github.com/AiGptCode/Backup-telegram-with-bot-token/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235534368,"owners_count":19005470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","bot","bot-father","hack","llm","telegram","token"],"created_at":"2024-11-25T05:34:31.978Z","updated_at":"2025-10-06T16:31:54.334Z","avatar_url":"https://github.com/AiGptCode.png","language":"Python","readme":"# Backup Telegram with bot token\n \nThis is a Telegram bot designed to back up messages and media files from Telegram chats to a local file system and a SQLite database. It handles various types of media including photos, videos, documents, voice messages, and more.\n\n## Features\n\n- Backups text messages and various media types (photos, videos, documents, etc.)\n- Stores message details and media file paths in a SQLite database\n- Asynchronously downloads media files to a specified directory\n- Configurable via environment variables\n\n## Requirements\n\n- Python 3.7 or later\n- Dependencies specified in `requirements.txt`\n\n## Setup\n\n### 1. Clone the Repository\n\n### 2. Create a Virtual Environment\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n```\n\n### 3. Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 4. Create a `.env` File\n\nCreate a `.env` file in the project root with the following content:\n\n```\nBOT_TOKEN=your_telegram_bot_token\nDATABASE_URL=sqlite:///telegram_backup.db\nMEDIA_BACKUP_DIR=telegram_media_backup\n```\n\nReplace `your_telegram_bot_token` with your actual Telegram bot token. The `DATABASE_URL` specifies the SQLite database file location (you can change this if you use a different database). `MEDIA_BACKUP_DIR` is the directory where media files will be stored.\n\n### 5. Run the Bot\n\n```bash\npython bot.py\n```\n\nThe bot will start polling for new messages and will back up messages and media to the specified directory and database.\n\n## Code Overview\n\n- **`bot.py`**: Main bot logic, including message handling and media backup.\n- **`requirements.txt`**: Python package dependencies.\n- **`.env`**: Configuration file for environment variables.\n- **`telegram_backup_bot.log`**: Log file for bot activities and errors.\n\n## Logging\n\nThe bot logs information and errors to `telegram_backup_bot.log`. Make sure this file is writable and check it for troubleshooting.\n\n## Contributing\n\nFeel free to submit issues or pull requests. Contributions are welcome!\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faigptcode%2Fbackup-telegram-with-bot-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faigptcode%2Fbackup-telegram-with-bot-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faigptcode%2Fbackup-telegram-with-bot-token/lists"}