Fix typos

This commit is contained in:
bitfl0wer 2023-05-27 19:36:07 +02:00
parent 12a04e866a
commit 7f707d337e
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::entities::{Guild, UnavailableGuild, User};
use crate::types::events::WebSocketEvent; 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 serde::{Deserialize, Serialize};
use super::PresenceUpdate; use super::PresenceUpdate;
#[derive(Debug, Deserialize, Serialize, Default)] #[derive(Debug, Deserialize, Serialize, Default)]
/// See https://discord.com/developers/docs/topics/gateway-events#guild-create /// 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 { pub struct GuildCreate {
#[serde(flatten)] #[serde(flatten)]
pub d: GuildCreateDataOption, pub d: GuildCreateDataOption,
@ -50,7 +50,7 @@ impl WebSocketEvent for GuildBanRemove {}
/// See https://discord.com/developers/docs/topics/gateway-events#guild-update /// See https://discord.com/developers/docs/topics/gateway-events#guild-update
pub struct GuildUpdate { pub struct GuildUpdate {
#[serde(flatten)] #[serde(flatten)]
pub guild: Guild pub guild: Guild,
} }
impl WebSocketEvent for GuildUpdate {} impl WebSocketEvent for GuildUpdate {}
@ -59,7 +59,7 @@ impl WebSocketEvent for GuildUpdate {}
/// See https://discord.com/developers/docs/topics/gateway-events#guild-delete /// See https://discord.com/developers/docs/topics/gateway-events#guild-delete
pub struct GuildDelete { pub struct GuildDelete {
#[serde(flatten)] #[serde(flatten)]
pub guild: UnavailableGuild pub guild: UnavailableGuild,
} }
impl WebSocketEvent for GuildDelete {} 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 /// See https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create
pub struct GuildAuditLogEntryCreate { pub struct GuildAuditLogEntryCreate {
#[serde(flatten)] #[serde(flatten)]
pub entry: AuditLogEntry pub entry: AuditLogEntry,
} }
impl WebSocketEvent for GuildAuditLogEntryCreate {} impl WebSocketEvent for GuildAuditLogEntryCreate {}
@ -77,7 +77,7 @@ impl WebSocketEvent for GuildAuditLogEntryCreate {}
/// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update /// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update
pub struct GuildEmojisUpdate { pub struct GuildEmojisUpdate {
pub guild_id: String, pub guild_id: String,
pub emojis: Vec<Emoji> pub emojis: Vec<Emoji>,
} }
impl WebSocketEvent for GuildEmojisUpdate {} impl WebSocketEvent for GuildEmojisUpdate {}
@ -86,7 +86,7 @@ impl WebSocketEvent for GuildEmojisUpdate {}
/// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update /// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update
pub struct GuildStickersUpdate { pub struct GuildStickersUpdate {
pub guild_id: String, pub guild_id: String,
pub stickers: Vec<Sticker> pub stickers: Vec<Sticker>,
} }
impl WebSocketEvent for GuildStickersUpdate {} impl WebSocketEvent for GuildStickersUpdate {}
@ -145,7 +145,7 @@ pub struct GuildMembersChunk {
pub chunk_count: u16, pub chunk_count: u16,
pub not_found: Option<Vec<String>>, pub not_found: Option<Vec<String>>,
pub presences: Option<PresenceUpdate>, pub presences: Option<PresenceUpdate>,
pub nonce: Option<String> pub nonce: Option<String>,
} }
impl WebSocketEvent for GuildMembersChunk {} impl WebSocketEvent for GuildMembersChunk {}

View File

@ -15,7 +15,7 @@ pub struct GatewayIdentifyPayload {
pub presence: Option<PresenceUpdate>, pub presence: Option<PresenceUpdate>,
// What is the difference between these two? // What is the difference between these two?
// Intents is documented, capabilities is used in users // 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")] #[serde(skip_serializing_if = "Option::is_none")]
pub intents: Option<i32>, pub intents: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -31,9 +31,18 @@ impl Default for GatewayIdentifyPayload {
impl GatewayIdentifyPayload { impl GatewayIdentifyPayload {
/// Uses the most common, 25% data along with client capabilities /// 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 { 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),
}
} }
} }
@ -111,7 +120,6 @@ impl Default for GatewayIdentifyConnectionProps {
} }
impl GatewayIdentifyConnectionProps { impl GatewayIdentifyConnectionProps {
/// Returns a minimal, least data possible default /// Returns a minimal, least data possible default
fn minimal() -> Self { fn minimal() -> Self {
Self { Self {