Skip to content

Commit

Permalink
fix(model): fix thread max message count (#1822)
Browse files Browse the repository at this point in the history
Change the type of channel's message_count to u64 to allow for larger
integers, since Discord is starting to track more detailed counts. I've
recently been receiving integers much larger than 50, such that a u8
would not suffice. This is currently not documented, however, I have
clarified with a Discord staff and it is the intended behaviour.
  • Loading branch information
chamburr authored Jul 9, 2022
1 parent 74a9053 commit 8a6fc52
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions model/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,8 @@ pub struct Channel {
#[serde(skip_serializing_if = "Option::is_none")]
pub member_count: Option<u8>,
/// Number of messages in the channel.
///
/// At most a value of 50 is provided although the real number may be
/// higher.
#[serde(skip_serializing_if = "Option::is_none")]
pub message_count: Option<u8>,
pub message_count: Option<u32>,
/// Name of the channel.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
Expand Down Expand Up @@ -370,7 +367,7 @@ mod tests {
user_id: Some(Id::new(5)),
}),
member_count: Some(50_u8),
message_count: Some(50_u8),
message_count: Some(50),
name: Some("newsthread".into()),
newly_created: Some(true),
nsfw: None,
Expand Down Expand Up @@ -451,7 +448,7 @@ mod tests {
user_id: Some(Id::new(5)),
}),
member_count: Some(50_u8),
message_count: Some(50_u8),
message_count: Some(50),
name: Some("publicthread".into()),
newly_created: Some(true),
nsfw: None,
Expand Down Expand Up @@ -533,7 +530,7 @@ mod tests {
user_id: Some(Id::new(5)),
}),
member_count: Some(50_u8),
message_count: Some(50_u8),
message_count: Some(50),
name: Some("privatethread".into()),
newly_created: Some(true),
nsfw: None,
Expand Down

0 comments on commit 8a6fc52

Please sign in to comment.