{"id":17094635,"url":"https://github.com/alxnull/tgsend","last_synced_at":"2025-04-12T23:13:04.837Z","repository":{"id":52974848,"uuid":"154572923","full_name":"alxnull/tgsend","owner":"alxnull","description":"Send messages to Telegram chats from the command line","archived":false,"fork":false,"pushed_at":"2021-05-24T10:11:31.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T23:12:59.787Z","etag":null,"topics":["python","python3","telegram","telegram-bots"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alxnull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-24T21:41:34.000Z","updated_at":"2022-11-12T16:58:51.000Z","dependencies_parsed_at":"2022-09-10T04:04:56.991Z","dependency_job_id":null,"html_url":"https://github.com/alxnull/tgsend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxnull%2Ftgsend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxnull%2Ftgsend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxnull%2Ftgsend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxnull%2Ftgsend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alxnull","download_url":"https://codeload.github.com/alxnull/tgsend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643006,"owners_count":21138355,"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":["python","python3","telegram","telegram-bots"],"created_at":"2024-10-14T14:23:39.945Z","updated_at":"2025-04-12T23:13:04.811Z","avatar_url":"https://github.com/alxnull.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tgsend - Telegram Messaging Tool\n\n[![PyPI](https://img.shields.io/pypi/v/tgsend.svg)](https://pypi.org/project/tgsend/)\n[![GitHub](https://img.shields.io/github/license/alxnull/tgsend.svg)](https://github.com/alxnull/tgsend/blob/master/LICENSE.txt)\n\ntgsend is a little Python module to send messages, photos and documents to Telegram chats via a Telegram bot. tgsend can be used either as a command line tool or as a module for Python 3.\n\n## Quick Start (Command Line)\n\n1. Create a Telegram Bot with the help of [@BotFather](https://t.me/BotFather) and take note of the bot token.\n2. Start a new chat with your bot or add it to a group where the messages should be sent to.\nFind out your personal chat ID or the chat ID of the group chat, e.g. by using [@Echo_ID_Bot](https://t.me/Echo_ID_Bot).\n_Important:_ Telegram Bots are shy, so you have to send the first message in a chat with them.\n3. Install tgsend with pip:\n```bash\nsudo pip3 install tgsend\n```\n4. Quickly configure tgsend with environment variables (see [Configuration](#configuration) for other options). In bash:\n```bash\nTGSEND_TOKEN=abcdefg # your bot token\nTGSEND_CHATID=1234567 # the chat ID of the private/ group chat\n```\n5. Test it:\n```bash\ntgsend \"Hello World\"\n```\n\n## Usage\n\n### From Command Line\n\nSend a text message with formatting:\n```bash\ntgsend --format markdown \"This is a text with *bold* and _italic_ words.\"\n```\n\nAdd a title and an icon:\n```bash\ntgsend -t \"Title\" --icon $'\\u2705' \"Some text.\"\n```\n\nSend a picture:\n```bash\ntgsend --photo image.png \"Image description.\"\n```\n\nSend a file:\n```bash\ntgsend --doc log.txt \"Log file\"\n```\n\nSend a video:\n```bash\ntgsend --video video.mp4 \"Video caption\"\n```\n\nSend a sticker:\n```bash\ntgsend --sticker sticker.webp\n```\n\nRead from stdin:\n```bash\ncat greeting.txt | tgsend -\n```\n\nType `tgsend --help` to see all options.\n\n### In Python\nExample:\n```python\nfrom tgsend import Telegram, ParseMode\n# token and chat ID will be searched in config files if not specified here\ntelegram = Telegram(\"your-bot-token\", \"your-chat-id\")\n# send a text message\ntelegram.send_message(\n    \"This is a text with *bold* and _italic_ words.\",\n    title=\"The Title\",\n    parse_mode=ParseMode.MARKDOWN\n)\n```\n\n## Configuration\n\nA configuration for tgsend always consists of a bot token and a chat ID.\nThese values can be either set through environment variables (as shown above) or through a configuration file.\n\n### Per-user and global configuration\n\nYou can place a per-user configuration file at `~/tgsend.conf` and a global configuration file at `/etc/tgsend.conf`.\nIf no environment variables are specified, tgsend will look for the required values in these files in the given order.\nThe format of this configuration file should look like this:\n```\n[Default]\nBotToken = your_bot_token\nChatID = your_chat_id\n```\n\n### More configuration options\n\nYou can add additional bot token/ chat ID profiles by adding a config section to the configuration file, e.g.:\n```\n[AltConfig]\nBotToken = different_bot_token\nChatID = another_chat_id\n```\nYou can then simply switch to this configuration with the `-c` option:\n```bash\ntgsend -c AltConfig \"Hello World\"\n```\n\nIt is also possible to specify a different location for the configuration file by using the `-l` option. E.g.:\n```bash\ntgsend -l ~/tgsend/botconfig.conf \"Some text\"\n```\ntgsend will now look for the `[Default]` section in the given configuration file.\n\n## License\n\nThis software is pusblished under [BSD-3-Clause license](https://github.com/alxnull/tgsend/blob/master/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxnull%2Ftgsend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falxnull%2Ftgsend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxnull%2Ftgsend/lists"}