diff --git a/src/api/types.rs b/src/api/types.rs index 129499a..a477985 100644 --- a/src/api/types.rs +++ b/src/api/types.rs @@ -1347,7 +1347,8 @@ pub struct ChannelUnreadUpdate { /// See also [ChannelUnreadUpdates] pub struct ChannelUnreadUpdateObject { pub id: String, - pub last_message_id: String + pub last_message_id: String, + pub last_pin_timestamp: Option } impl WebSocketEvent for ChannelUnreadUpdate {} @@ -1567,6 +1568,19 @@ pub struct GuildRoleDelete { impl WebSocketEvent for GuildRoleDelete {} +#[derive(Debug, Deserialize, Serialize, Default)] +/// Officially Undocumented +/// +/// Seems to be passively set to update the client on guild details (though, why not just send the update events?) +pub struct PassiveUpdateV1 { + pub voice_states: Vec, + pub members: Vec, + pub guild_id: String, + pub channels: Vec, +} + +impl WebSocketEvent for PassiveUpdateV1 {} + #[derive(Debug, Default, Deserialize, Serialize)] /// See https://discord.com/developers/docs/topics/gateway-events#integration-create pub struct IntegrationCreate { diff --git a/src/gateway.rs b/src/gateway.rs index 5677465..fab1434 100644 --- a/src/gateway.rs +++ b/src/gateway.rs @@ -340,6 +340,10 @@ impl Gateway { "GUILD_SCHEDULED_EVENT_DELETE" => {} "GUILD_SCHEDULED_EVENT_USER_ADD" => {} "GUILD_SCHEDULED_EVENT_USER_REMOVE" => {} + "PASSIVE_UPDATE_V1" => { + let new_data: PassiveUpdateV1 = serde_json::from_str(gateway_payload.d.unwrap().get()).unwrap(); + self.events.lock().await.guild.passive_update_v1.update_data(new_data).await; + } "INTEGRATION_CREATE" => { let new_data: IntegrationCreate = serde_json::from_str(gateway_payload.d.unwrap().get()).unwrap(); self.events.lock().await.integration.create.update_data(new_data).await; @@ -395,8 +399,6 @@ impl Gateway { let new_data: PresenceUpdate = serde_json::from_str(gateway_payload.d.unwrap().get()).unwrap(); self.events.lock().await.user.presence_update.update_data(new_data).await; } - // What is this? - "PASSIVE_UPDATE_V1" => {} "STAGE_INSTANCE_CREATE" => {} "STAGE_INSTANCE_UPDATE" => {} "STAGE_INSTANCE_DELETE" => {} @@ -690,6 +692,7 @@ mod events { pub role_scheduled_event_delete: GatewayEvent, pub role_scheduled_event_user_add: GatewayEvent, pub role_scheduled_event_user_remove: GatewayEvent,*/ + pub passive_update_v1: GatewayEvent, } #[derive(Default, Debug)]