telexide_fork/
lib.rs

1//! Telexide is a rust library for the telegram API
2//!
3//! View the [examples] to see practical examples of how to use the library.
4//!
5//! Use the [`ClientBuilder`] to easily create a [`Client`] object to your
6//! preferences and register commands with the [`create_framework`] macro and/or
7//! register your own update handlers, before running [`Client::start`] to start
8//! your bot. All of this is designed to be highly customisable. For further
9//! information about the client, please see the [client's module-level
10//! documentation][client].
11//!
12//! API calls are easy to make using the [`APIClient`] and the api data models,
13//! or create and use your own api client by implementing the [`API`] trait. For
14//! further information about the api client, please see the [api's module-level
15//! documentation][api].
16//!
17//! A default command framework is provided using the [`Framework`] object,
18//! providing easy handling of incoming [telegram bot commands][tg_commands]
19//! sent by users of your bot. For further information about the framework,
20//! please see the [framework's module-level documentation][framework].
21//!
22//! Telegram also has their own [API docs for bots][tg docs]. Although this
23//! documentation will try to be as accurate as possible, if you need to be
24//! sure, refer to their docs.
25//!
26//! # Resources
27//!  - [Examples][examples]
28//!  - [Github Repository]
29//!  - [crates.io]
30//!
31//! # Installation
32//!
33//! Add the following to your `Cargo.toml` file:
34//!
35//! ```toml
36//! [dependencies]
37//! telexide = "0.1"
38//! ```
39//!
40//! [examples]: https://github.com/callieve/telexide/tree/master/examples
41//! [Github Repository]: https://github.com/callieve/telexide
42//! [crates.io]: https://crates.io/crates/telexide
43//! [tg docs]: https://core.telegram.org/bots/api
44//! [client]: client/index.html
45//! [`ClientBuilder`]: client/struct.ClientBuilder.html
46//! [`Client`]: client/struct.Client.html
47//! [`Client::start`]: client/struct.Client.html#method.start
48//! [`APIClient`]: api/struct.APIClient.html
49//! [`API`]: api/trait.API.html
50//! [api]: api/index.html
51//! [tg_commands]: https://core.telegram.org/bots#commands
52//! [`Framework`]: framework/struct.Framework.html
53//! [framework]: framework/index.html
54
55#![warn(clippy::pedantic)]
56#![allow(
57    dead_code,
58    clippy::module_inception,
59    clippy::must_use_candidate,
60    clippy::missing_errors_doc,
61    clippy::module_name_repetitions,
62    clippy::struct_excessive_bools,
63    clippy::wildcard_imports
64)]
65
66pub mod api;
67pub mod client;
68pub mod framework;
69pub mod model;
70mod utils;
71
72/// Macros for using the framework and helping with adding listeners
73pub mod macros {
74    pub use super::create_framework;
75    pub use telexide_fork_proc_macros::{command, prepare_listener};
76}
77
78pub use client::Client;
79pub use utils::result::{Error, Result};
80
81pub mod prelude {
82    //! A default set of exports which can be helpful to use.
83    //!
84    //! note that [`TelexideError`] is a re-export of [`telexide_fork::Error`] under
85    //! a different name to remove likely ambiguity with other crate error
86    //! enums.
87    //!
88    //! ## Examples
89    //!
90    //! Import all of the exports:
91    //!
92    //! ```rust
93    //! use telexide_fork::prelude::*;
94    //! ```
95    //!
96    //! [`telexide_fork::Error`]: ../enum.Error.html
97    //! [`TelexideError`]: ../enum.Error.html
98
99    pub use super::{
100        client::{Client, ClientBuilder, Context},
101        create_framework,
102        framework::CommandResult,
103        model::{Message, Update},
104        Error as TelexideError,
105    };
106    pub use telexide_fork_proc_macros::{command, prepare_listener};
107}
108
109#[doc(hidden)]
110#[allow(unused_imports)]
111pub use paste::expr as paste_expr;