3 releases (breaking)

0.3.0 Jan 23, 2022
0.2.0 Nov 8, 2021
0.1.0 Nov 8, 2021

#1071 in Network programming

Download history 1/week @ 2024-01-26 4/week @ 2024-02-02 2/week @ 2024-02-16 14/week @ 2024-02-23 11/week @ 2024-03-01 8/week @ 2024-03-08 7/week @ 2024-03-15 8/week @ 2024-03-22 52/week @ 2024-03-29 10/week @ 2024-04-05 2/week @ 2024-04-12

73 downloads per month
Used in 4 crates

MIT license

375KB
6.5K SLoC

telbot

Active Development

Telbot provides telegram bot types and API wrappers.

Specifically, telbot now supports:

  • telbot-types: basic telegram types / requests / responses
[dependencies]
telbot-types = "0.3.0"
  • telbot-cf-worker: API wrapper for cloudflare workers
[dependencies]
telbot-cf-worker = "0.3.0"
  • telbot-ureq: API wrapper for ureq client
[dependencies]
telbot-ureq = "0.3.0"
  • telbot-hyper: API wrapper for hyper client
[dependencies]
telbot-hyper = "0.1.0"

Examples

Extending telbot

You can implement two methods, send_json and send_file with your own http client to create your own API wrapper.

send_json should serialize JsonMethod into json format and send it to the API endpoint.

send_file should serialize FileMethod into multipart/form-data format and send it to the API endpoint.

files(&self) method in FileMethod helps getting fields of type InputFileVariant.

For the ease of serializing, both JsonMethod and FileMethod implements serde::Serialize.

TelegramMethod, the super trait of both JsonMethod and FileMethod, provides name() method, which can be used to get the method's name in &str format.

Contributing

telbot is not a mature project yet, so your help will be very helpful.

Please leave an issue if you find wrongly coded piece or get a nice idea to improve telbot.

Dependencies

~0.4–1MB
~24K SLoC