Aims
- Full support of latest Bot API version no webhooks yet
- 1 to 1 API methods and entitities mapping
- Ease of use
Features
- Fully async
- Utility extension methods for API entities (e.g.
message.reply
method) - Ability to set default request params (e.g.
parse_mode
orallow_sending_without_reply
) - Can be used in multithreaded context
- Full control over update handling
TODO
- More handy entity methods
-
Webhooks support
- Logging
- More examples
Quick usage overview
Using Local Bot API Server
let server_config = local;
let api_config = new?
let api = API new;
Setting default parse_mode
let mut api = API new;
// Setting parse_mode for sendMessage request
api.set_default_request_param?;
// For all applicable requests
api.set_parse_mode?;
Calling API methods
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.reply_to_message_id;
// All requests implement IntoFuture
let message = request.await?;
// You can handle some common API errors automatically
let message = API request.await?;
Mutating and calling requests by references
let mut request = api.send_message;
for i in 0..5
FAQ
Q: Is it production-ready? A: It may be, or may be not. The library is not thoroughly tested, some stuff may be broken. Q: Are there any bots made with it? A: I developed this library to be used by @hintorbot, so at least this one. If you want to list your bot here, contact me in tg: @encrypted_for