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};
/// 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 op: i32,
pub d: HelloData,
@ -10,7 +10,7 @@ pub struct 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;
pub struct HelloData {
/// 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_with::serde_as;
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct GatewayIdentifyPayload {
pub token: String,
pub properties: GatewayIdentifyConnectionProps,
@ -144,7 +144,7 @@ impl GatewayIdentifyConnectionProps {
referring_domain: None,
referrer_current: None,
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"),
os: String::from("Windows"),
os_version: Some(String::from("10")),
client_build_number: 199933,
client_build_number: 222963,
release_channel: String::from("stable"),
..Self::minimal()
}

View File

@ -2,7 +2,7 @@ use crate::types::{events::WebSocketEvent, UserStatus};
use crate::types::{Activity, ClientStatusObject, PublicUser, Snowflake};
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;
/// See <https://discord.com/developers/docs/topics/gateway-events#update-presence>
pub struct UpdatePresence {
@ -14,7 +14,7 @@ pub struct UpdatePresence {
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
/// See <https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields>
pub struct PresenceUpdate {

View File

@ -1,7 +1,7 @@
use crate::types::{events::WebSocketEvent, Snowflake, VoiceState};
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);
///
@ -28,7 +28,7 @@ pub struct 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>;
///
/// 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};
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Activity {
name: String,
#[serde(rename = "type")]
@ -22,7 +22,7 @@ pub struct Activity {
buttons: Option<Vec<ActivityButton>>,
}
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)]
struct ActivityTimestamps {
start: Option<i64>,
end: Option<i64>,

View File

@ -1,6 +1,6 @@
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>
pub struct ClientStatusObject {
pub desktop: Option<String>,

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use crate::types::Snowflake;
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
/// A schema used to modify a user.
pub struct UserModifySchema {
@ -29,7 +29,7 @@ pub struct UserModifySchema {
///
/// # Reference:
/// 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 recipients: Option<Vec<Snowflake>>,
pub access_tokens: Option<Vec<String>>,