rustelebot
Telegram Bot API in Rust. Right now it supports only send message with sendMessage with no exhuastive features or input fields of such API.
Main use case of this library is to integrate it with your application
to quickly send message to telegram bot, in turn send message to telegram chat group
or telegram channel group provided that we know chat_id
.
APIs
create_instance
- create a bot instance consistsing of Telegram's bot token, and targetchat_id
send_message
- call Telegram bot's APIsendMessage
to send message synchronouslysend_message_async
- call Telegram bot's APIsendMessage
to send message asynchronously
Example
Send Synchronously
Send in simple way
Send in MarkdownV2
or HTML
style message
Send message in MarkdownV2
use ;
Send messsage in HTML
use ;
Send Asynchronously
Similarly we can provide SendMessageOption
as seen in synchronized way. Functionalities
are equal.
Tests
You can test by define the following two environment variables
RUSTELEBOT_BOT_TOKEN
- telegram bot's tokenRUSTELEBOT_CHAT_ID
- telegram bot's chat id
then execute
cargo test
some tests will send a single, or multiple messages to specified chat id on behalf
of such telegram bot. Please take a look at src/tests.rs
.
Note
You can utilize this telegram bot @username_to_id_bot
in order to get your
telegram channel's chat_id
.
License
MIT, Wasin Thonkaew