diff --git a/CHANGELOG.md b/CHANGELOG.md index 4928f9ef3b..1747a6a7bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ [Commits](https://github.com/twitch-rs/twitch_api/compare/v0.7.0...Unreleased) +### Fixed + +- Eventsub `channel.moderate` action `Timeout` and `Ban` field `reason` is now `None` when the string is empty. + ## [v0.7.0] - 2025-01-22 [Commits](https://github.com/twitch-rs/twitch_api/compare/v0.6.1...v0.7.0) diff --git a/src/eventsub/channel/moderate.rs b/src/eventsub/channel/moderate.rs index f35abf433a..6be3f401f5 100644 --- a/src/eventsub/channel/moderate.rs +++ b/src/eventsub/channel/moderate.rs @@ -279,6 +279,10 @@ pub struct Ban { /// The user name of the user being banned. pub user_name: types::DisplayName, /// Reason given for the ban. + #[serde( + default, + deserialize_with = "crate::deserialize_none_from_empty_string" + )] pub reason: Option, } @@ -307,6 +311,10 @@ pub struct Timeout { /// The user name of the user being timed out. pub user_name: types::DisplayName, /// The reason given for the timeout. + #[serde( + default, + deserialize_with = "crate::deserialize_none_from_empty_string" + )] pub reason: Option, /// The time at which the timeout ends. pub expires_at: types::Timestamp, @@ -870,6 +878,10 @@ pub struct Warn { /// The user name of the user being warned. pub user_name: types::DisplayName, /// Reason given for the warning. + #[serde( + default, + deserialize_with = "crate::deserialize_none_from_empty_string" + )] pub reason: Option, /// Chat rules cited for the warning. pub chat_rules_cited: Option>,