1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
//! Make cool Telegram bots with Rust easily. Here is a simple echo bot: //! //! ```no_run //! use tbot::prelude::*; //! //! # /* //! #[tokio::main] //! async fn main() { //! # */ //! # // is there a way to enable `tokio/macros` for examples? //! # async fn bot() { //! let mut bot = tbot::from_env!("BOT_TOKEN").event_loop(); //! //! bot.text(|context| { //! async move { //! let echo = &context.text.value; //! let call_result = context.send_message(echo).call().await; //! //! if let Err(err) = call_result { //! dbg!(err); //! } //! } //! }); //! //! bot.polling().start().await.unwrap(); //! } //! ``` //! //! If you're new to `tbot`, we recommend you go through the [tutorial] first. //! We also have several [How-to guides][how-to] with snippets to solve your //! problems. //! //! If you have a question, ask it in [our group] on Telegram. If you find //! a bug, fill an issue on either our [GitLab] or [GitHub] repository. //! //! [our group]: https://t.me/tbot_group //! [tutorial]: https://gitlab.com/SnejUgal/tbot/wikis/Tutorial //! [how-to]: https://gitlab.com/SnejUgal/tbot/wikis/How-to //! [GitLab]: https://gitlab.com/SnejUgal/tbot //! [GitHub]: https://github.com/SnejUgal/tbot #![deny( future_incompatible, nonstandard_style, missing_docs, clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo )] #![allow(clippy::multiple_crate_versions)] // can't do much #![allow(clippy::needless_doctest_main)] // that's where you're wrong, kiddo mod bot; mod download_file; mod internal; mod multipart; mod token; pub mod connectors; pub mod contexts; pub mod errors; pub mod event_loop; pub mod methods; pub mod types; use {download_file::download_file, multipart::Multipart, token::Token}; pub use {bot::Bot, event_loop::EventLoop}; pub mod prelude { //! Traits needed when working with `tbot`. pub use super::contexts::traits::*; }