From da9232da0bcbe14c13a72b4411c4ec4a63ce2709 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sat, 27 May 2023 19:36:07 +0200 Subject: [PATCH] Fix typos --- src/types/events/guild.rs | 20 +++++++++---------- src/types/events/identify.rs | 38 ++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/types/events/guild.rs b/src/types/events/guild.rs index 75bd2e4..6ddd95d 100644 --- a/src/types/events/guild.rs +++ b/src/types/events/guild.rs @@ -1,14 +1,14 @@ -use crate::types::{AuditLogEntry, Emoji, Sticker, GuildMember, RoleObject, GuildScheduledEvent}; use crate::types::entities::{Guild, UnavailableGuild, User}; use crate::types::events::WebSocketEvent; -use chrono::{Utc, DateTime}; +use crate::types::{AuditLogEntry, Emoji, GuildMember, GuildScheduledEvent, RoleObject, Sticker}; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use super::PresenceUpdate; #[derive(Debug, Deserialize, Serialize, Default)] /// See https://discord.com/developers/docs/topics/gateway-events#guild-create -/// This one is particularly painful, it can be a Guild object with extra field or an unavailbile guild object +/// This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object pub struct GuildCreate { #[serde(flatten)] pub d: GuildCreateDataOption, @@ -50,7 +50,7 @@ impl WebSocketEvent for GuildBanRemove {} /// See https://discord.com/developers/docs/topics/gateway-events#guild-update pub struct GuildUpdate { #[serde(flatten)] - pub guild: Guild + pub guild: Guild, } impl WebSocketEvent for GuildUpdate {} @@ -59,7 +59,7 @@ impl WebSocketEvent for GuildUpdate {} /// See https://discord.com/developers/docs/topics/gateway-events#guild-delete pub struct GuildDelete { #[serde(flatten)] - pub guild: UnavailableGuild + pub guild: UnavailableGuild, } impl WebSocketEvent for GuildDelete {} @@ -68,7 +68,7 @@ impl WebSocketEvent for GuildDelete {} /// See https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create pub struct GuildAuditLogEntryCreate { #[serde(flatten)] - pub entry: AuditLogEntry + pub entry: AuditLogEntry, } impl WebSocketEvent for GuildAuditLogEntryCreate {} @@ -77,7 +77,7 @@ impl WebSocketEvent for GuildAuditLogEntryCreate {} /// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update pub struct GuildEmojisUpdate { pub guild_id: String, - pub emojis: Vec + pub emojis: Vec, } impl WebSocketEvent for GuildEmojisUpdate {} @@ -86,7 +86,7 @@ impl WebSocketEvent for GuildEmojisUpdate {} /// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update pub struct GuildStickersUpdate { pub guild_id: String, - pub stickers: Vec + pub stickers: Vec, } impl WebSocketEvent for GuildStickersUpdate {} @@ -145,7 +145,7 @@ pub struct GuildMembersChunk { pub chunk_count: u16, pub not_found: Option>, pub presences: Option, - pub nonce: Option + pub nonce: Option, } impl WebSocketEvent for GuildMembersChunk {} @@ -222,4 +222,4 @@ pub struct GuildScheduledEventUserRemove { pub guild_id: String, } -impl WebSocketEvent for GuildScheduledEventUserRemove {} \ No newline at end of file +impl WebSocketEvent for GuildScheduledEventUserRemove {} diff --git a/src/types/events/identify.rs b/src/types/events/identify.rs index 86f7e6c..55283eb 100644 --- a/src/types/events/identify.rs +++ b/src/types/events/identify.rs @@ -15,7 +15,7 @@ pub struct GatewayIdentifyPayload { pub presence: Option, // What is the difference between these two? // Intents is documented, capabilities is used in users - // I wonder if these are interchangable.. + // I wonder if these are interchangeable... #[serde(skip_serializing_if = "Option::is_none")] pub intents: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -30,10 +30,19 @@ impl Default for GatewayIdentifyPayload { impl GatewayIdentifyPayload { /// Uses the most common, 25% data along with client capabilities - /// - /// Basically pretends to be an official client on windows 10, with chrome 113.0.0.0 + /// + /// Basically pretends to be an official client on Windows 10, with Chrome 113.0.0.0 pub fn common() -> Self { - Self { token: "".to_string(), properties: GatewayIdentifyConnectionProps::default(), compress: Some(false), large_threshold: None, shard: None, presence: None, intents: None, capabilities: Some(8189) } + Self { + token: "".to_string(), + properties: GatewayIdentifyConnectionProps::default(), + compress: Some(false), + large_threshold: None, + shard: None, + presence: None, + intents: None, + capabilities: Some(8189), + } } } @@ -58,36 +67,36 @@ impl WebSocketEvent for GatewayIdentifyPayload {} #[derive(Debug, Deserialize, Serialize)] pub struct GatewayIdentifyConnectionProps { /// Almost always sent - /// + /// /// ex: "Linux", "Windows", "Mac OS X" - /// + /// /// ex (mobile): "Windows Mobile", "iOS", "Android", "BlackBerry" pub os: String, /// Almost always sent - /// + /// /// ex: "Firefox", "Chrome", "Opera Mini", "Opera", "Blackberry", "Facebook Mobile", "Chrome iOS", "Mobile Safari", "Safari", "Android Chrome", "Android Mobile", "Edge", "Konqueror", "Internet Explorer", "Mozilla", "Discord Client" pub browser: String, /// Sometimes not sent, acceptable to be "" - /// + /// /// Speculation: /// Only sent for mobile devices - /// + /// /// ex: "BlackBerry", "Windows Phone", "Android", "iPhone", "iPad", "" pub device: String, /// Almost always sent, most commonly en-US - /// + /// /// ex: "en-US" pub system_locale: String, /// Almost always sent - /// + /// /// ex: any user agent, most common is "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" pub browser_user_agent: String, /// Almost always sent - /// + /// /// ex: "113.0.0.0" pub browser_version: String, /// Sometimes not sent, acceptable to be "" - /// + /// /// ex: "10" (For os = "Windows") pub os_version: String, /// Sometimes not sent, acceptable to be "" @@ -111,7 +120,6 @@ impl Default for GatewayIdentifyConnectionProps { } impl GatewayIdentifyConnectionProps { - /// Returns a minimal, least data possible default fn minimal() -> Self { Self { @@ -150,4 +158,4 @@ impl GatewayIdentifyConnectionProps { return default; } -} \ No newline at end of file +}