diff options
| author | n1c00o <git.n1c00o@gmail.com> | 2021-10-02 23:17:30 +0200 |
|---|---|---|
| committer | n1c00o <git.n1c00o@gmail.com> | 2021-10-02 23:17:30 +0200 |
| commit | 2310289660ffc41a338dbf02d07410c3163ec08e (patch) | |
| tree | a503369e2c334e1f91637b279650b6185324169b /common/rust/src | |
| parent | ca0efb3e31b48812e934b5615878a40b767f1abd (diff) | |
Add channel-related structures
Diffstat (limited to 'common/rust/src')
| -rw-r--r-- | common/rust/src/discord_models/channel.rs | 89 | ||||
| -rw-r--r-- | common/rust/src/discord_models/mod.rs | 1 |
2 files changed, 90 insertions, 0 deletions
diff --git a/common/rust/src/discord_models/channel.rs b/common/rust/src/discord_models/channel.rs new file mode 100644 index 0000000..41f4a4b --- /dev/null +++ b/common/rust/src/discord_models/channel.rs @@ -0,0 +1,89 @@ +use serde::{Deserialize, Serialize}; +use serde_repr::{Deserialize_repr, Serialize_repr}; + +use super::user::User; + +#[derive(Debug, Clone, Deserialize_repr, Serialize_repr)] +#[repr(u8)] +pub enum ChannelTypes { + GuildText = 0, + Dm = 1, + GuildVoice = 2, + GroupDm = 3, + GuildCategory = 4, + GuildNews = 5, + GuildStore = 6, + GuildNewsThread = 10, + GuildPublicThread = 11, + GuildPrivateThread = 12, + GuildStageVoice = 13, +} + +#[derive(Debug, Clone, Deserialize_repr, Serialize_repr)] +#[repr(u8)] +pub enum VideoQualityModes { + Auto = 1, + Full = 2, +} + +#[derive(Debug, Clone, Deserialize_repr, Serialize_repr)] +#[repr(u8)] +pub enum OverwriteTypes { + Role = 0, + Member = 1, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Overwrite { + pub id: String, + #[serde(rename = "type")] + pub type_: OverwriteTypes, + pub allow: String, + pub deny: String, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct ThreadMetadata { + pub archived: bool, + pub auto_archive_duration: i64, + pub archive_timestamp: String, + pub locked: Option<bool>, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct ThreadMember { + pub id: Option<String>, + pub user_id: Option<String>, + pub join_timestamp: String, + pub flags: i64, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Channel { + pub id: String, + #[serde(rename = "type")] + pub type_: ChannelTypes, + pub guild_id: Option<String>, + pub position: Option<i64>, + pub permission_overwrites: Option<Vec<Overwrite>>, + pub name: Option<String>, + pub topic: Option<String>, + pub nsfw: Option<bool>, + pub last_message_id: Option<String>, + pub bitrate: Option<i64>, + pub user_limit: Option<i64>, + pub rate_limit_per_user: Option<i64>, + pub recipients: Option<Vec<User>>, + pub icon: Option<String>, + pub owner_id: Option<String>, + pub application_id: Option<String>, + pub parent_id: Option<String>, + pub last_pin_timestamp: Option<String>, + pub rtc_region: Option<String>, + pub video_quality_mode: Option<VideoQualityModes>, + pub message_count: Option<i64>, + pub member_count: Option<i64>, + pub thread_metadata: Option<ThreadMetadata>, + pub member: Option<ThreadMember>, + pub default_auto_archive_duration: Option<i64>, +} diff --git a/common/rust/src/discord_models/mod.rs b/common/rust/src/discord_models/mod.rs index 2bcde7c..29bf5a6 100644 --- a/common/rust/src/discord_models/mod.rs +++ b/common/rust/src/discord_models/mod.rs @@ -1,4 +1,5 @@ pub mod application; +pub mod channel; pub mod guild; pub mod stage_instance; pub mod teams; |
