{"id":19134527,"url":"https://github.com/azerothcore/telegram-automated-db-backup","last_synced_at":"2025-09-25T22:26:17.876Z","repository":{"id":49607555,"uuid":"267707633","full_name":"azerothcore/telegram-automated-db-backup","owner":"azerothcore","description":"Python script to automated the db backup using Telegram as cloud storage","archived":false,"fork":false,"pushed_at":"2024-05-22T17:22:32.000Z","size":58,"stargazers_count":61,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T01:28:26.507Z","etag":null,"topics":["azerothcore-tools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azerothcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-05-28T22:14:38.000Z","updated_at":"2025-02-05T07:36:52.000Z","dependencies_parsed_at":"2024-05-30T01:28:20.475Z","dependency_job_id":null,"html_url":"https://github.com/azerothcore/telegram-automated-db-backup","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"db21fe6ac786ab95b9b3075253e87ff5a2edb2bf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Ftelegram-automated-db-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Ftelegram-automated-db-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Ftelegram-automated-db-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azerothcore%2Ftelegram-automated-db-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azerothcore","download_url":"https://codeload.github.com/azerothcore/telegram-automated-db-backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248960957,"owners_count":21189990,"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":["azerothcore-tools"],"created_at":"2024-11-09T06:26:59.257Z","updated_at":"2025-09-25T22:26:12.841Z","avatar_url":"https://github.com/azerothcore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram automated db backup\n\n![Telegram automated db backup](icon.png)\n\nThis repo provides a Python script that does a **daily backup** and upload it automatically to a Telegram group chat.\nThis way, you do not need to take care of where to save the backups or buying any cloud service.\n\n\n## How does it work?\n\nThe Python script it's based on:\n- pyrogram\n- unix commands (like mysqldump, zip)\n\n**Pyrogram** is a python framework which allows you to use your [Telegram](https://telegram.org) account, so with this framework you can send a message, files, pictures etc. automatically without doing it manually.\n\n\n### Requirements\n\nTo use the script `bak.py` you need:\n- a Telegram account\n- python3\n- pyrogram\n- tgcrypto (optional, but recommended)\n- zip\n- mysql-client (for mysqldump)\n\nTo install these software in a Linux distro **Debian-based** you can run:\n```bash\n$ sudo apt install python3 python3-pip zip mysql-client\n```\n\nTo install the python packages you can use the python package manager **pip**:\n```\n$ pip3 install pyrogram tgcrypto\n```\n\n### Configuration\nPlease replace the following values with your personal data\n```python\n# database connection config\nmysql_localhost = \"localhost\"\nmysql_username = \"USERNAME\"\nmysql_password = \"PASSWORD\"\n\nworld_db = \"acore_world\"\nchar_db = \"acore_characters\"\nauth_db = \"acore_auth\"\n\n# zip config\nzip_password = \"db_zipped\"\nzip_name = \"db-{:%Y%m%d}.zip\".format(datetime.now()) # this will result in a string like \"db-20211231.zip\"\n\n# replace \"me\" with a chat_id or username to change the chat\nchat_id = \"me\"\n# Telegram client config\nusername = \"TELEGRAM_USERNAME\"\napi_id=1234567\napi_hash=\"1234d401234d401234d401234d40\"\n```\n\n### Usage\n\nTo allow pyrogram to use your account you need to have an username on Telegram and create a Telegram 3rd \"app\" here: https://my.telegram.org/auth?to=apps.\nGenerated the app, this app will have **api_id** and **api_hash**, put these data into the conf part in`bak.py`.\n\nAfterward, fill the mysql credentials and the zip password and run the python script using\n```bash\n$ python3 bak.py\n```\n\nNote: alternatively, you can also run `bak-per-table.py` if you want to make a backup with one file per table instead of one file per db.\n\nThe first time, pyrogram will need from your telegram account a TOKEN that you will receive on Telegram, after this, pyrogram will generate a sqlite database in the same directory of bak.py to keep the session with your Telegram user.\n\nFinally, you just need to run the script bak.py and your db will be pushed in your personal chat (\"Saved Messages\" / \"me\").\n\nYou can change the chat where push the zip archive, replacing \"me\" on line 30 with a chat_id or a Telegram @Username,\nif you don't know your chat_id you can ask [@username_to_id_bot](https://t.me/username_to_id_bot) to get it.\n\n### Optional, run it daily using crontab\n\nTo run the script daily you can create a cronjob using `crontab` (usually it is installed as default on a Linux server).\nSo open crontab using:\n```\n$ crontab -e\n```\n\nFill the last line with:\n```\n0 0 * * * cd ~/root/path/project/; python3 bak.py\n```\n\nThis will run the script daily on at midnight 😉.\n\nThat's all!\nOpen an issue if you need anything.\n\n\n## Credits\n- [Helias](https://github.com/Helias)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazerothcore%2Ftelegram-automated-db-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazerothcore%2Ftelegram-automated-db-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazerothcore%2Ftelegram-automated-db-backup/lists"}