Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiwiyou/telbot
Rust telegram bot library for many runtimes
https://github.com/kiwiyou/telbot
bot telegram
Last synced: 2 months ago
JSON representation
Rust telegram bot library for many runtimes
- Host: GitHub
- URL: https://github.com/kiwiyou/telbot
- Owner: kiwiyou
- License: mit
- Created: 2021-09-26T04:48:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T16:46:34.000Z (9 months ago)
- Last Synced: 2024-10-12T22:29:21.296Z (3 months ago)
- Topics: bot, telegram
- Language: Rust
- Homepage: https://docs.rs/telbot-types
- Size: 163 KB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telbot
[![Active Development](https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg)](https://github.com/kiwiyou/telbot)
Telbot provides telegram bot types and API wrappers.
Specifically, telbot now supports:
- telbot-types: basic telegram types / requests / responses
```toml
[dependencies]
telbot-types = "0.3.0"
```- telbot-cf-worker: API wrapper for cloudflare workers
```toml
[dependencies]
telbot-cf-worker = "0.3.0"
```- telbot-ureq: API wrapper for [ureq](https://github.com/algesten/ureq) client
```toml
[dependencies]
telbot-ureq = "0.3.1"
```- telbot-hyper: API wrapper for [hyper](https://github.com/hyperium/hyper) client
```toml
[dependencies]
telbot-hyper = "0.3.0"
```## Examples
- [cloudflare workers](https://github.com/kiwiyou/telbot/tree/main/telbot-cf-worker/examples)
- [get-me request example](https://github.com/kiwiyou/telbot/tree/main/telbot-cf-worker/examples/get-me)
- [echo bot example](https://github.com/kiwiyou/telbot/tree/main/telbot-cf-worker/examples/echo)
- [file(photo) send example](https://github.com/kiwiyou/telbot/tree/main/telbot-cf-worker/examples/file)
- [ureq](https://github.com/kiwiyou/telbot/tree/main/telbot-ureq/examples)
- [echo example](https://github.com/kiwiyou/telbot/blob/main/telbot-ureq/examples/echo.rs)
- [file(photo) send example](https://github.com/kiwiyou/telbot/blob/main/telbot-ureq/examples/file.rs)
- [hyper](https://github.com/kiwiyou/telbot/tree/main/telbot-hyper/examples)
- [echo example](https://github.com/kiwiyou/telbot/blob/main/telbot-hyper/examples/echo.rs)
- [file(photo) send example](https://github.com/kiwiyou/telbot/blob/main/telbot-hyper/examples/file.rs)## 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.