serenity/model/
mod.rs

1//! Mappings of objects received from the API, with optional helper methods for ease of use.
2//!
3//! Models can optionally have additional helper methods compiled, by enabling the `model` feature.
4//!
5//! Normally you can import models through the sub-modules:
6//!
7//! ```rust,no_run
8//! use serenity::model::channel::{ChannelType, GuildChannel, Message};
9//! use serenity::model::id::{ChannelId, GuildId};
10//! use serenity::model::user::User;
11//! ```
12//!
13//! This can get a bit tedious - especially with a large number of imports - so this can be
14//! simplified by simply glob importing everything from the prelude:
15//!
16//! ```rust,no_run
17//! use serenity::model::prelude::*;
18//! ```
19
20#[macro_use]
21mod utils;
22
23pub mod application;
24pub mod channel;
25pub mod colour;
26pub mod connection;
27pub mod error;
28pub mod event;
29pub mod gateway;
30pub mod guild;
31pub mod id;
32pub mod invite;
33pub mod mention;
34pub mod misc;
35pub mod monetization;
36pub mod permissions;
37pub mod sticker;
38pub mod timestamp;
39pub mod user;
40pub mod voice;
41pub mod webhook;
42
43#[cfg(feature = "voice_model")]
44pub use serenity_voice_model as voice_gateway;
45
46pub use self::colour::{Color, Colour};
47pub use self::error::Error as ModelError;
48pub use self::permissions::Permissions;
49pub use self::timestamp::Timestamp;
50
51/// The model prelude re-exports all types in the model sub-modules.
52///
53/// This allows for quick and easy access to all of the model types.
54///
55/// # Examples
56///
57/// Import all model types into scope:
58///
59/// ```rust,no_run
60/// use serenity::model::prelude::*;
61/// ```
62pub mod prelude {
63    pub(crate) use std::collections::HashMap;
64
65    pub(crate) use serde::de::Visitor;
66    pub(crate) use serde::{Deserialize, Deserializer};
67
68    pub use super::guild::automod::EventType as AutomodEventType;
69    #[doc(hidden)]
70    pub use super::guild::automod::{
71        Action,
72        ActionExecution,
73        ActionType,
74        KeywordPresetType,
75        Rule,
76        Trigger,
77        TriggerMetadata,
78        TriggerType,
79    };
80    #[doc(hidden)]
81    pub use super::{
82        application::*,
83        channel::*,
84        colour::*,
85        connection::*,
86        event::*,
87        gateway::*,
88        guild::audit_log::*,
89        guild::*,
90        id::*,
91        invite::*,
92        mention::*,
93        misc::*,
94        monetization::*,
95        permissions::*,
96        sticker::*,
97        user::*,
98        voice::*,
99        webhook::*,
100        ModelError,
101        Timestamp,
102    };
103    pub(crate) use crate::internal::prelude::*;
104}