diff --git a/src/api/types.rs b/src/api/types.rs index 9433150..f4b07fa 100644 --- a/src/api/types.rs +++ b/src/api/types.rs @@ -8,7 +8,7 @@ use std::{cell::RefCell, rc::Rc, collections::HashMap}; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use serde_json::from_value; -use serde_aux::{field_attributes::deserialize_option_number_from_string, prelude::{deserialize_string_from_number, deserialize_number_from_string, deserialize_bool_from_anything}}; +use serde_aux::{field_attributes::deserialize_option_number_from_string, prelude::{deserialize_string_from_number, deserialize_number_from_string}}; use crate::{api::limits::Limits, instance::Instance}; @@ -217,76 +217,6 @@ pub struct GuildBan { pub reason: Option, } -/// See https://discord.com/developers/docs/topics/gateway-events#guild-create-guild-create-extra-fields -/// This is like [Guild], expect it has extra fields -#[derive(Serialize, Deserialize, Debug, Default, Clone)] -pub struct GuildCreateGuild { - pub id: String, - pub name: String, - pub icon: Option, - pub icon_hash: Option, - pub splash: Option, - pub discovery_splash: Option, - pub owner: Option, - pub owner_id: String, - pub permissions: Option, - pub afk_channel_id: Option, - pub afk_timeout: u8, - pub widget_enabled: Option, - pub widget_channel_id: Option, - pub verification_level: u8, - pub default_message_notifications: u8, - pub explicit_content_filter: u8, - pub roles: Vec, - pub emojis: Vec, - pub features: Vec, - pub mfa_level: u8, - pub application_id: Option, - pub system_channel_id: Option, - pub system_channel_flags: u8, - pub rules_channel_id: Option, - pub max_presences: Option, - pub max_members: Option, - pub vanity_url_code: Option, - pub description: Option, - pub banner: Option, - pub premium_tier: u8, - pub premium_subscription_count: Option, - pub preferred_locale: String, - pub public_updates_channel_id: Option, - pub max_video_channel_users: Option, - pub max_stage_video_channel_users: Option, - pub approximate_member_count: Option, - pub approximate_presence_count: Option, - pub welcome_screen: Option, - pub nsfw_level: u8, - pub stickers: Option>, - pub premium_progress_bar_enabled: bool, - // ------ Extra Fields ------ - pub joined_at: DateTime, - pub large: bool, - pub unavailable: Option, - pub member_count: u64, - // to:do implement voice states - //pub voice_states: Vec, - pub members: Vec, - pub channels: Vec, - pub threads: Vec, - pub presences: Vec, - // to:do add stage instances - //pub stage_instances: Vec, - // to:do add guild schedules events - //pub guild_scheduled_events: Vec -} - -impl GuildCreateGuild { - /// Converts self to a [Guild], discarding the extra fields - pub fn to_guild(&self) -> Guild { - let as_value = serde_json::to_value(&self).unwrap(); - return from_value(as_value).unwrap(); - } -} - #[derive(Serialize, Deserialize, Debug, Default, Clone)] pub struct WelcomeScreenObject { pub description: Option,