{"id":26484899,"url":"https://github.com/stunnel/tgsend","last_synced_at":"2025-03-20T05:53:18.565Z","repository":{"id":64304505,"uuid":"367233225","full_name":"stunnel/tgsend","owner":"stunnel","description":"Send messages and files over Telegram from the command line.","archived":false,"fork":false,"pushed_at":"2022-06-05T15:23:33.000Z","size":1661,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T08:20:43.730Z","etag":null,"topics":["command-line","golang","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stunnel.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}},"created_at":"2021-05-14T02:57:08.000Z","updated_at":"2024-03-24T23:47:35.000Z","dependencies_parsed_at":"2023-01-15T10:15:52.013Z","dependency_job_id":null,"html_url":"https://github.com/stunnel/tgsend","commit_stats":null,"previous_names":["travislee8964/tgsend"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stunnel%2Ftgsend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stunnel%2Ftgsend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stunnel%2Ftgsend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stunnel%2Ftgsend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stunnel","download_url":"https://codeload.github.com/stunnel/tgsend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244560369,"owners_count":20472219,"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":["command-line","golang","telegram","telegram-bot"],"created_at":"2025-03-20T05:53:18.090Z","updated_at":"2025-03-20T05:53:18.559Z","avatar_url":"https://github.com/stunnel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tgsend in golang\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\ntelegram-send in golang  \ntgsend is a command-line tool to send messages and files over Telegram to your account, group or channel.\n\n\u003c!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again --\u003e\n**Table of Contents**\n\n- [tgsend in golang](#tgsend-in-golang)\n  - [Usage](#usage)\n    - [Command parameter](#command-parameter)\n      - [Message type priority](#message-type-priority)\n    - [Start](#start)\n    - [Example](#example)\n  - [Build](#build)\n\n\u003c!-- markdown-toc end --\u003e\n\n## Usage\n\n### Command parameter\n\n```shell\ntgsend -h\n\n  -token string\n    Set the bot token.\n  -chatid int\n    Send message to this User ID or Channel ID or Group ID.\n\n  -message string\n    The message to sent.\n  -pre\n    Send preformatted fixed-width (monospace) text.\n  -format string\n    How to format the message(s). Choose from ['text', 'markdown', 'html'] (default 'text')\n  -preview\n    disable link previews in the message(s)\n\n  -filename path\n    The file to sent.\n  -filetype string\n    Set the file type, Choose from ['photo', 'video', 'document', 'audio', 'sticker', 'animation'] (default 'document')\n  -caption string\n    Set the photo/video/document/audio/animation caption\n\n  -location\n    Send location\n  -latitude float\n    Set latitude, value valid [-90, 90]\n  -longitude float\n    Set longitude, value valid [-180, 180]\n\n  -timeout int\n    Set the read timeout for network operations(in seconds). (default 30)\n  -debug\n    Show debug message.\n  -version\n    Print version information.\n```\n\n#### Message type priority\n\n**message \u003e location \u003e file**  \nIt means that if you provide a `message`, parameters such as `location`, `filetype` and `caption` will not be used.\n\n### Start\n\n1. Create a bot.  \n   Chat with BotFather \u003chttps://telegram.me/botfather\u003e, send /newbot command to create a new bot, and get the token, for example `110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw`\n2. Chat with your bot, use your Telegram account.\n3. Get your telegram account's ID. Send any message to \u003chttps://t.me/RawDataBot\u003e, This bot will return the raw message from Telegram(json format). `[\"message\"][\"from\"][\"id\"]` is your account's ID. eg `12345678`.\n4. Afterward, now you can send a message via `tgsend`.  \n   `tgsend -token 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw -chatid 12345678 -message \"Hello World.\"`\n\nThere is a maximum message length of 4096 characters and 50 MiB of file limit by Telegram, larger messages will be automatically split up into smaller ones and sent separately, larger files will fail to send.\n\n### Example\n\nSend a message:\n\nSet environment variables\n\n```shell\nTG_TOKEN=110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw\nTG_CHAT_ID=12345678\n```\n\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -message \"Hello World.\"\n```\n\nSend from stdin:\n\n```shell\necho \"now: $(date)\" | tgsend -chatid \"${TG_CHAT_ID}\" \\\n    -token \"${TG_TOKEN}\" \\\n    -message -\n```\n\nTo send a message using Markdown or HTML formatting:\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -format markdown -message \"*bold text* _italic text_\"\n\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -format html -message '\u003cb\u003ebold\u003c/b\u003e, \u003cstrong\u003ebold\u003c/strong\u003e\n\u003ci\u003eitalic\u003c/i\u003e, \u003cem\u003eitalic\u003c/em\u003e\n\u003ca href=\"https://www.example.com/\"\u003einline URL\u003c/a\u003e\n\u003ca href=\"tg://user?id=123456789\"\u003einline mention of a user\u003c/a\u003e\n\u003ccode\u003einline fixed-width code\u003c/code\u003e\n\u003cpre\u003epre-formatted fixed-width code block\u003c/pre\u003e'\n```\n\nsend a message using Markdown with multi lines:\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -format markdown -message '*bold text*\n_italic text_\n[inline URL](https://www.example.com/)\n[inline mention of a user](tg://user?id=123456789)\n`inline fixed-width code`\n ```block_language\npre-formatted fixed-width code block\n ```'\n```\n\nFor more information on supported formatting, see the [Formatting options](https://core.telegram.org/bots/api#formatting-options).\n\nThe `--pre` flag formats messages as fixed-width text:\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -pre -message \"monospace\"\n```\n\nTo send a message without link previews:\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -preview -message \"https://github.com/\"\n```\n\nSend a file (maximum file size of 50 MB):\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -filetype document -filename document.pdf\n```\n\nTo send an image with an optional caption (maximum file size of 10 MB):\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -filetype photo -filename photo.jpg -caption \"The Moon at night\"\n```\n\nTo send a location via latitude and longitude:\n\n```shell\ntgsend -token \"${TG_TOKEN}\" -chatid \"${TG_CHAT_ID}\" \\\n       -location -latitude 35.5398033 -longitude -79.7488965\n```\n\n## Build\n\nbuild directly from source:\n\n```shell\ngo build -o tgsend tgsend.go\n```\n\nmake releases:\n\n```shell\nmake release\n```\n\nThen you can find the compressed binaries in the `release` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstunnel%2Ftgsend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstunnel%2Ftgsend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstunnel%2Ftgsend/lists"}