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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! # Stoat API Wrapper
//!
//! A high-level Stoat API wrapper.
//!
//! ## Getting Started
//!
//! This crate requires some boilerplate to ensure errors are handled from the crate and your bot seemlessly
//! along with defining your event callbacks.
//!
//! ### Defining Your Error Type
//! Almost every event, command and callback uses your error type to allow you to propagate custom errors and
//! stoat-rs errors throughout your code.
//!
//! It is reconmended to use [`thiserror`](https://docs.rs/thiserror/latest/thiserror/) to define your error
//! however a manual implemenation is also possible if you prefer manually implementing [`From`].
//!
//! Your error must implement `From<stoat::Error>`, [`Debug`], [`Clone`], [`Send`], [`Sync`] and be `'static`.
//!
//! ```rust
//! #[derive(Debug, Clone, thiserror::Error)]
//! pub enum Error {
//! #[error("Stoat Error: {0}")]
//! StoatError(#[from] stoat::Error),
//! }
//! ```
//!
//! ### Setting Up Events
//! All events are implemented as a function in the [`EventHandler`] trait.
//!
//! Every event's first parameter is [`Context`] which contains the current bot state, this is given to you
//! in-place of your [`Client`].
//!
//! ```rust
//! use stoat::{async_trait, EventHandler, Context};
//!
//! #[derive(Debug, Clone)]
//! struct Events;
//!
//! #[async_trait]
//! impl EventHandler for Events {
//! type Error = Error; // Your error type defined above
//!
//! async fn ready(&self, context: Context) -> Result<(), Self::Error> {
//! println!("Ready!");
//!
//! Ok(())
//! }
//! }
//! ```
//!
//! ### Running The Bot
//! Once you define your events you can create your [`Client`] which will be the root entry for running your bot.
//!
//! For customizing your client's config see the [`Client`] documentation.
//!
//! ```rust
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
//! Client::new(Events).await?.run("BOT TOKEN").await
//! }
//! ```
//!
//! ## Commands
//!
//! See the [`commands`] module documentation for setting up commands.
//!
//! ## Logging
//! This crate makes use of the [`log`](https://docs.rs/log/latest/log/) crate to relay information and errors to you.
//!
//! Ensure you have a log implementation setup to see the logs.
pub use ;
pub use Client;
pub use Context;
pub use ;
pub use EventHandler;
pub use *;
pub use LocalFile;
pub use HttpClient;
pub use Ulid;
pub use *;
pub use *;
pub use async_trait;
pub use either;