There is a echo bot, but plain text:
```rust use tgflows::{listento_update, Telegram, UpdateKind};
pub fn run() { let telegramtoken = std::env::var("telegramtoken").unwrap(); let tele = Telegram::new(telegram_token.clone());
listen_to_update(telegram_token, |update| {
if let UpdateKind::Message(msg) = update.kind {
let text = msg.text().unwrap_or("");
let chat_id = msg.chat.id;
let _sended_msg = tele.send_message(chat_id, text);
}
});
} ```
[Telegram::new()] is a Telegram
constructor that represents a bot.
[listentoupdate()] is responsible for registering a listener for the bot
represented by the telegram_token
. When a new Update
coming, the callback
is called with received Update
.