minor changes to READY_SUPPLEMENTAL
This commit is contained in:
parent
f3ee3a8d8a
commit
4c4ae516a4
|
@ -20,7 +20,9 @@ pub struct UpdatePresence {
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, WebSocketEvent)]
|
||||||
/// 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>
|
||||||
|
/// (Same structure as <https://docs.discord.sex/resources/presence#presence-object>)
|
||||||
pub struct PresenceUpdate {
|
pub struct PresenceUpdate {
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|
|
@ -6,13 +6,14 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::entities::{Guild, User};
|
use crate::types::entities::{Guild, User};
|
||||||
use crate::types::events::{Session, WebSocketEvent};
|
use crate::types::events::{Session, WebSocketEvent};
|
||||||
use crate::types::interfaces::ClientStatusObject;
|
use crate::types::{Activity, Channel, ClientStatusObject, GuildMember, PresenceUpdate, Snowflake, VoiceState};
|
||||||
use crate::types::{Activity, GuildMember, PresenceUpdate, VoiceState};
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
||||||
/// 1/2 half documented;
|
/// 1/2 officially documented;
|
||||||
/// Received after identifying, provides initial user info;
|
/// Received after identifying, provides initial user info;
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#ready;>
|
///
|
||||||
|
/// See <https://docs.discord.sex/topics/gateway-events#ready> and <https://discord.com/developers/docs/topics/gateway-events#ready>
|
||||||
|
// TODO: There are a LOT of fields missing here
|
||||||
pub struct GatewayReady {
|
pub struct GatewayReady {
|
||||||
pub analytics_token: Option<String>,
|
pub analytics_token: Option<String>,
|
||||||
pub auth_session_id_hash: Option<String>,
|
pub auth_session_id_hash: Option<String>,
|
||||||
|
@ -32,36 +33,47 @@ pub struct GatewayReady {
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// Sent after the READY event when a client is a user, seems to somehow add onto the ready event;
|
/// Sent after the READY event when a client is a user,
|
||||||
|
/// seems to somehow add onto the ready event;
|
||||||
|
///
|
||||||
|
/// See <https://docs.discord.sex/topics/gateway-events#ready-supplemental>
|
||||||
pub struct GatewayReadySupplemental {
|
pub struct GatewayReadySupplemental {
|
||||||
|
/// The presences of the user's relationships and guild presences sent at startup
|
||||||
pub merged_presences: MergedPresences,
|
pub merged_presences: MergedPresences,
|
||||||
pub merged_members: Vec<Vec<GuildMember>>,
|
pub merged_members: Vec<Vec<GuildMember>>,
|
||||||
// ?
|
pub lazy_private_channels: Vec<Channel>,
|
||||||
pub lazy_private_channels: Vec<serde_json::Value>,
|
|
||||||
pub guilds: Vec<SupplementalGuild>,
|
pub guilds: Vec<SupplementalGuild>,
|
||||||
// ? pomelo
|
// "Upcoming changes that the client should disclose to the user" (discord.sex)
|
||||||
pub disclose: Vec<String>,
|
pub disclose: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
|
/// See <https://docs.discord.sex/topics/gateway-events#merged-presences-structure>
|
||||||
pub struct MergedPresences {
|
pub struct MergedPresences {
|
||||||
|
/// "Presences of the user's guilds in the same order as the guilds array in ready"
|
||||||
|
/// (discord.sex)
|
||||||
pub guilds: Vec<Vec<MergedPresenceGuild>>,
|
pub guilds: Vec<Vec<MergedPresenceGuild>>,
|
||||||
|
/// "Presences of the user's friends and implicit relationships" (discord.sex)
|
||||||
pub friends: Vec<MergedPresenceFriend>,
|
pub friends: Vec<MergedPresenceFriend>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
|
/// Not documented even unofficially
|
||||||
pub struct MergedPresenceFriend {
|
pub struct MergedPresenceFriend {
|
||||||
pub user_id: String,
|
pub user_id: Snowflake,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
/// Looks like ms??
|
// Looks like ms??
|
||||||
pub last_modified: u128,
|
//
|
||||||
|
// Not always sent
|
||||||
|
pub last_modified: Option<u128>,
|
||||||
pub client_status: ClientStatusObject,
|
pub client_status: ClientStatusObject,
|
||||||
pub activities: Vec<Activity>,
|
pub activities: Vec<Activity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
|
/// Not documented even unofficially
|
||||||
pub struct MergedPresenceGuild {
|
pub struct MergedPresenceGuild {
|
||||||
pub user_id: String,
|
pub user_id: Snowflake,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
// ?
|
// ?
|
||||||
pub game: Option<serde_json::Value>,
|
pub game: Option<serde_json::Value>,
|
||||||
|
@ -70,8 +82,10 @@ pub struct MergedPresenceGuild {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
|
/// See <https://docs.discord.sex/topics/gateway-events#supplemental-guild-structure>
|
||||||
pub struct SupplementalGuild {
|
pub struct SupplementalGuild {
|
||||||
|
pub id: Snowflake,
|
||||||
pub voice_states: Option<Vec<VoiceState>>,
|
pub voice_states: Option<Vec<VoiceState>>,
|
||||||
pub id: String,
|
/// Field not documented even unofficially
|
||||||
pub embedded_activities: Vec<serde_json::Value>,
|
pub embedded_activities: Vec<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue