Fix typos

This commit is contained in:
bitfl0wer 2023-05-27 19:36:07 +02:00
parent a26ded8ab2
commit da9232da0b
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
2 changed files with 33 additions and 25 deletions

View File

@ -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<Emoji>
pub emojis: Vec<Emoji>,
}
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<Sticker>
pub stickers: Vec<Sticker>,
}
impl WebSocketEvent for GuildStickersUpdate {}
@ -145,7 +145,7 @@ pub struct GuildMembersChunk {
pub chunk_count: u16,
pub not_found: Option<Vec<String>>,
pub presences: Option<PresenceUpdate>,
pub nonce: Option<String>
pub nonce: Option<String>,
}
impl WebSocketEvent for GuildMembersChunk {}
@ -222,4 +222,4 @@ pub struct GuildScheduledEventUserRemove {
pub guild_id: String,
}
impl WebSocketEvent for GuildScheduledEventUserRemove {}
impl WebSocketEvent for GuildScheduledEventUserRemove {}

View File

@ -15,7 +15,7 @@ pub struct GatewayIdentifyPayload {
pub presence: Option<PresenceUpdate>,
// 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<i32>,
#[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;
}
}
}