From 2310289660ffc41a338dbf02d07410c3163ec08e Mon Sep 17 00:00:00 2001 From: n1c00o Date: Sat, 2 Oct 2021 23:17:30 +0200 Subject: [PATCH] Add channel-related structures --- common/rust/src/discord_models/channel.rs | 89 +++++++++++++++++++++++ common/rust/src/discord_models/mod.rs | 1 + 2 files changed, 90 insertions(+) create mode 100644 common/rust/src/discord_models/channel.rs 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, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct ThreadMember { + pub id: Option, + pub user_id: Option, + 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, + pub position: Option, + pub permission_overwrites: Option>, + pub name: Option, + pub topic: Option, + pub nsfw: Option, + pub last_message_id: Option, + pub bitrate: Option, + pub user_limit: Option, + pub rate_limit_per_user: Option, + pub recipients: Option>, + pub icon: Option, + pub owner_id: Option, + pub application_id: Option, + pub parent_id: Option, + pub last_pin_timestamp: Option, + pub rtc_region: Option, + pub video_quality_mode: Option, + pub message_count: Option, + pub member_count: Option, + pub thread_metadata: Option, + pub member: Option, + pub default_auto_archive_duration: Option, +} 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; -- 2.39.5