Skip to content

Commit

Permalink
Add ReadState and ReadStateEntry, add ReadState to GatewayReady
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfl0wer committed Oct 24, 2024
1 parent f65b9c1 commit b23fb68
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/types/events/ready.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use std::collections::HashMap;

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

use crate::types::entities::{Guild, User};
Expand Down Expand Up @@ -92,6 +93,7 @@ pub struct GatewayReady {
/// Guild experiment rollouts for the user
/// TODO: Make Guild Experiments into own struct
pub guild_experiments: Vec<String>,
pub read_state: ReadState,
}

#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
Expand Down Expand Up @@ -229,3 +231,24 @@ pub struct SupplementalGuild {
/// Field not documented even unofficially
pub embedded_activities: Vec<serde_json::Value>,
}

#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
/// Not documented even unofficially. Information about this type is likely to be partially incorrect.
pub struct ReadState {
entries: Vec<ReadStateEntry>,
partial: bool,
version: u32,
}

#[derive(
Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy,
)]
/// Not documented even unofficially. Information about this type is likely to be partially incorrect.
pub struct ReadStateEntry {
flags: u32,
id: Snowflake,
last_message_id: Option<Snowflake>,
last_pin_timestamp: Option<DateTime<Utc>>,
last_viewed: Option<DateTime<Utc>>,
mention_count: u64,
}

0 comments on commit b23fb68

Please sign in to comment.