Even more derives

This commit is contained in:
kozabrada123 2023-08-29 18:16:45 +02:00
parent 2cd48a948c
commit b04a906112
7 changed files with 14 additions and 14 deletions

View File

@ -2,7 +2,7 @@ use crate::types::WebSocketEvent;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Received on gateway init, tells the client how often to send heartbeats; /// Received on gateway init, tells the client how often to send heartbeats;
#[derive(Debug, Default, Deserialize, Serialize)] #[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct GatewayHello { pub struct GatewayHello {
pub op: i32, pub op: i32,
pub d: HelloData, pub d: HelloData,
@ -10,7 +10,7 @@ pub struct GatewayHello {
impl WebSocketEvent for GatewayHello {} impl WebSocketEvent for GatewayHello {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, Copy)]
/// Contains info on how often the client should send heartbeats to the server; /// Contains info on how often the client should send heartbeats to the server;
pub struct HelloData { pub struct HelloData {
/// How often a client should send heartbeats, in milliseconds /// How often a client should send heartbeats, in milliseconds

View File

@ -2,7 +2,7 @@ use crate::types::events::{PresenceUpdate, WebSocketEvent};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_with::serde_as; use serde_with::serde_as;
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Clone)]
pub struct GatewayIdentifyPayload { pub struct GatewayIdentifyPayload {
pub token: String, pub token: String,
pub properties: GatewayIdentifyConnectionProps, pub properties: GatewayIdentifyConnectionProps,
@ -144,7 +144,7 @@ impl GatewayIdentifyConnectionProps {
referring_domain: None, referring_domain: None,
referrer_current: None, referrer_current: None,
release_channel: String::from("stable"), release_channel: String::from("stable"),
client_build_number: 199933, client_build_number: 0,
} }
} }
@ -159,7 +159,7 @@ impl GatewayIdentifyConnectionProps {
system_locale: String::from("en-US"), system_locale: String::from("en-US"),
os: String::from("Windows"), os: String::from("Windows"),
os_version: Some(String::from("10")), os_version: Some(String::from("10")),
client_build_number: 199933, client_build_number: 222963,
release_channel: String::from("stable"), release_channel: String::from("stable"),
..Self::minimal() ..Self::minimal()
} }

View File

@ -2,7 +2,7 @@ use crate::types::{events::WebSocketEvent, UserStatus};
use crate::types::{Activity, ClientStatusObject, PublicUser, Snowflake}; use crate::types::{Activity, ClientStatusObject, PublicUser, Snowflake};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// Sent by the client to update its status and presence; /// Sent by the client to update its status and presence;
/// See <https://discord.com/developers/docs/topics/gateway-events#update-presence> /// See <https://discord.com/developers/docs/topics/gateway-events#update-presence>
pub struct UpdatePresence { pub struct UpdatePresence {
@ -14,7 +14,7 @@ pub struct UpdatePresence {
pub afk: bool, pub afk: bool,
} }
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Default, Clone)]
/// Received to tell the client that a user updated their presence / status /// Received to tell the client that a user updated their presence / status
/// See <https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields> /// See <https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields>
pub struct PresenceUpdate { pub struct PresenceUpdate {

View File

@ -1,7 +1,7 @@
use crate::types::{events::WebSocketEvent, Snowflake, VoiceState}; use crate::types::{events::WebSocketEvent, Snowflake, VoiceState};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default)] #[derive(Debug, Deserialize, Serialize, Default, Clone, Copy, PartialEq, Eq)]
/// ///
/// Sent to the server to indicate an update of the voice state (leave voice channel, join voice channel, mute, deafen); /// Sent to the server to indicate an update of the voice state (leave voice channel, join voice channel, mute, deafen);
/// ///
@ -28,7 +28,7 @@ pub struct VoiceStateUpdate {
impl WebSocketEvent for VoiceStateUpdate {} impl WebSocketEvent for VoiceStateUpdate {}
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
/// See <https://discord.com/developers/docs/topics/gateway-events#voice-server-update>; /// See <https://discord.com/developers/docs/topics/gateway-events#voice-server-update>;
/// ///
/// Received to indicate which voice endpoint, token and guild_id to use; /// Received to indicate which voice endpoint, token and guild_id to use;

View File

@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use crate::types::{entities::Emoji, Snowflake}; use crate::types::{entities::Emoji, Snowflake};
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Activity { pub struct Activity {
name: String, name: String,
#[serde(rename = "type")] #[serde(rename = "type")]
@ -22,7 +22,7 @@ pub struct Activity {
buttons: Option<Vec<ActivityButton>>, buttons: Option<Vec<ActivityButton>>,
} }
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)]
struct ActivityTimestamps { struct ActivityTimestamps {
start: Option<i64>, start: Option<i64>,
end: Option<i64>, end: Option<i64>,

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default, Clone)] #[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
/// See <https://discord.com/developers/docs/topics/gateway-events#client-status-object> /// See <https://discord.com/developers/docs/topics/gateway-events#client-status-object>
pub struct ClientStatusObject { pub struct ClientStatusObject {
pub desktop: Option<String>, pub desktop: Option<String>,

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use crate::types::Snowflake; use crate::types::Snowflake;
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
/// A schema used to modify a user. /// A schema used to modify a user.
pub struct UserModifySchema { pub struct UserModifySchema {
@ -29,7 +29,7 @@ pub struct UserModifySchema {
/// ///
/// # Reference: /// # Reference:
/// Read: <https://discord-userdoccers.vercel.app/resources/channel#json-params> /// Read: <https://discord-userdoccers.vercel.app/resources/channel#json-params>
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct PrivateChannelCreateSchema { pub struct PrivateChannelCreateSchema {
pub recipients: Option<Vec<Snowflake>>, pub recipients: Option<Vec<Snowflake>>,
pub access_tokens: Option<Vec<String>>, pub access_tokens: Option<Vec<String>>,