Crates.io | conogram |
lib.rs | conogram |
version | 0.2.19 |
source | src |
created_at | 2023-06-06 12:42:39.226593 |
updated_at | 2024-11-17 14:18:01.132764 |
description | An async wrapper for Telegram Bot API |
homepage | https://github.com/ENCRYPTEDFOREVER/conogram |
repository | https://github.com/ENCRYPTEDFOREVER/conogram |
max_upload_size | |
id | 883820 |
size | 1,098,992 |
Full support of latest Bot API version no webhooks yet
1 to 1 API methods and entitities mapping
Ease of use
message.reply
method)How to enable logging in your executable
let server_config = ApiServerConfig::local("http://localhost", 80, true);
let api_config = APIConfig::new("BOT_TOKEN", server_config)?
let api = API::new(api_config);
let mut api = API::new(/**/);
// Required request parameters are in the request constructor, optionals are set via builder-like methods
// ChatId can be username of a channel
let request = api.send_message("@channelusername","Text").reply_to_message_id(42);
// All requests implement IntoFuture
let message = request.await?;
// You can handle some common API errors automatically:
// 1. By wrapping manually
let message = API::request(request).await?;
// 2. Or by using a trait
use conogram::api::WrapRequest;
let message = request.wrap().await?;
let mut request = api.send_message(chat_id, "Text");
for i in 0..5 {
request = request.chat_id(i);
// &Request implements IntoFuture too
let message = (&request).await?;
}
Q: Is it production-ready?
A: The library is not thoroughly tested, some stuff may be broken, unconventional or unusable for you. The reason is I'm developing it for my personal use. But if you're using it too, suggestions on improvement are welcome