{"id":20987160,"url":"https://github.com/haxpor/rustelebot","last_synced_at":"2025-07-19T19:02:15.571Z","repository":{"id":57665222,"uuid":"452330041","full_name":"haxpor/rustelebot","owner":"haxpor","description":"Minimal telegram Bot API in Rust just to send message to telegram's group/channel","archived":false,"fork":false,"pushed_at":"2022-03-15T21:38:53.000Z","size":41,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-06T09:53:10.475Z","etag":null,"topics":["api","bot","rust","telegram"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rustelebot","language":"Rust","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/haxpor.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":"2022-01-26T15:30:09.000Z","updated_at":"2024-09-15T07:05:44.000Z","dependencies_parsed_at":"2022-09-26T20:31:17.438Z","dependency_job_id":null,"html_url":"https://github.com/haxpor/rustelebot","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/haxpor/rustelebot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxpor%2Frustelebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxpor%2Frustelebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxpor%2Frustelebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxpor%2Frustelebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haxpor","download_url":"https://codeload.github.com/haxpor/rustelebot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxpor%2Frustelebot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265992482,"owners_count":23860913,"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":["api","bot","rust","telegram"],"created_at":"2024-11-19T06:16:11.239Z","updated_at":"2025-07-19T19:02:15.495Z","avatar_url":"https://github.com/haxpor.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rustelebot\nTelegram Bot API in Rust. Right now it supports only send message with [sendMessage](https://core.telegram.org/bots/api#sendmessage)\nwith no exhuastive features or input fields of such API.\n\nMain use case of this library is to integrate it with your application\nto quickly send message to telegram bot, in turn send message to telegram chat group\nor telegram channel group provided that we know `chat_id`.\n\n# APIs\n\n* `create_instance` - create a bot instance consistsing of Telegram's bot token, and target `chat_id`\n* `send_message` - call Telegram bot's API `sendMessage` to send message synchronously\n* `send_message_async` - call Telegram bot's API `sendMessage` to send message asynchronously\n\n# Example\n\n## Send Synchronously\n\n### Send in simple way\n\n```rust\nfn main() {\n\tlet instance = rustelebot::create_instance(\"123456:123456\", \"-1000000\");\n\tif let Err(_) = rustelebot::send_message(\u0026instance, \"Hello world\", None) {\n\t\t// error handling here...\n\t}\n}\n```\n\n### Send in `MarkdownV2` or `HTML` style message\n\nSend message in `MarkdownV2`\n\n```rust\nuse rustelebot::types::{SendMessageOption, SendMessageParseMode};\n\nfn main() {\n\tlet instance = rustelebot::create_instance(\"123456:123456\", \"-1000000\");\n\tlet option = SendMessageOption { parse_mode: Some(SendMessageParseMode::MarkdownV2) };\n\n\t// note on two spaces at the end of the line for a new line in markdown\n\tif let Err(_) = rustelebot::send_message(\u0026instance,\nr#\"__Hello world__  \n`Tap to copy this text`  \nVisit my [website](https://wasin.io)\"#, Some(option)) {\n\t\t// error handling here...\n\t}\n}\n```\n\nSend messsage in `HTML`\n\n```rust\nuse rustelebot::types::{SendMessageOption, SendMessageParseMode};\n\nfn main() {\n\tlet instance = rustelebot::create_instance(\"123456:123456\", \"-1000000\");\n\tlet option = SendMessageOption { parse_mode: Some(SendMessageParseMode::HTML) };\n\n\tif let Err(_) = rustelebot::send_message(\u0026instance,\nr#\"\u003cu\u003eHello world\u003c/u\u003e\n\u003ccode\u003eTap to copy this text\u003c/code\u003e\nVisit my \u003ca href=\"https://wasin.io\"\u003ewebsite\u003c/a\u003e\"#, Some(option)) {\n\t\t// error handling here...\n\t}\n}\n```\n\n# Send Asynchronously\n\n```rust\nfn main() {\n\tlet instance = rustelebot::create_instance(\"123456:123456\", \"-1000000\");\n\n\tasync fn async_fn(instance: \u0026BotInstance) {\n\t\tlet f1 = rustelebot::send_message_async(\u0026instance, \"Msg1\", None);\n\t\tlet f2 = rustelebot::send_message_async(\u0026instance, \"Msg2\", None);\n\t\tlet f3 = rustelebot::send_message_async(\u0026instance, \"Msg3\", None);\n\t\tlet f4 = rustelebot::send_message_async(\u0026instance, \"Msg4\", None);\n\n\t\t// wait for all futures\n\t\t// this doesn't not guarantee order\n\t\tfutures::join!(f1, f2, f3, f4);\n\t}\n\n\t// block on the current thread for the whole async (futures) to complete\n\tfutures::executor::block_on(async_fn(\u0026instance));\n}\n```\n\nSimilarly we can provide `SendMessageOption` as seen in synchronized way. Functionalities\nare equal.\n\n# Tests\n\nYou can test by define the following two environment variables\n\n* `RUSTELEBOT_BOT_TOKEN` - telegram bot's token\n* `RUSTELEBOT_CHAT_ID` - telegram bot's chat id\n\nthen execute\n\n`cargo test`\n\nsome tests will send a single, or multiple messages to specified chat id on behalf\nof such telegram bot. Please take a look at `src/tests.rs`.\n\n# Note\n\nYou can utilize this telegram bot `@username_to_id_bot` in order to get your\ntelegram channel's `chat_id`.\n\n# License\nMIT, Wasin Thonkaew\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaxpor%2Frustelebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaxpor%2Frustelebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaxpor%2Frustelebot/lists"}