Skip to content

Commit a63d7e9

Browse files
committed
update channel ban and channel unban to include new fields
1 parent fb13b9a commit a63d7e9

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

src/eventsub/channel/ban.rs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,30 @@ impl EventSubscription for ChannelBanV1 {
2525
#[cfg_attr(not(feature = "allow_unknown_fields"), serde(deny_unknown_fields))]
2626
#[non_exhaustive]
2727
pub struct ChannelBanV1Payload {
28-
/// The requested broadcaster ID.
29-
pub broadcaster_user_id: types::UserId,
30-
/// The requested broadcaster login.
31-
pub broadcaster_user_login: types::UserName,
32-
/// The requested broadcaster display name.
33-
pub broadcaster_user_name: types::DisplayName,
3428
/// The user ID for the user who was banned on the specified channel.
3529
pub user_id: types::UserId,
3630
/// The user login for the user who was banned on the specified channel.
3731
pub user_login: types::UserName,
3832
/// The requested broadcaster display name.
3933
pub user_name: types::DisplayName,
34+
/// The requested broadcaster ID.
35+
pub broadcaster_user_id: types::UserId,
36+
/// The requested broadcaster login.
37+
pub broadcaster_user_login: types::UserName,
38+
/// The requested broadcaster display name.
39+
pub broadcaster_user_name: types::DisplayName,
40+
/// The user ID of the issuer of the ban.
41+
pub moderator_user_id: types::UserId,
42+
/// The user login of the issuer of the ban.
43+
pub moderator_user_login: types::UserName,
44+
/// The user name of the issuer of the ban.
45+
pub moderator_user_name: types::DisplayName,
46+
/// The reason behind the ban.
47+
pub reason: String,
48+
/// Will be null if permanent ban. If it is a timeout, this field shows when the timeout will end.
49+
pub ends_at: Option<types::Timestamp>,
50+
/// Indicates whether the ban is permanent (true) or a timeout (false). If true, ends_at will be null.
51+
pub is_permanent: bool,
4052
}
4153

4254
#[test]
@@ -62,7 +74,13 @@ fn parse_payload() {
6274
"user_name": "Cool_User",
6375
"broadcaster_user_id": "1337",
6476
"broadcaster_user_login": "cooler_user",
65-
"broadcaster_user_name": "Cooler_User"
77+
"broadcaster_user_name": "Cooler_User",
78+
"moderator_user_id": "1339",
79+
"moderator_user_login": "mod_user",
80+
"moderator_user_name": "Mod_User",
81+
"reason": "Offensive language",
82+
"ends_at": "2020-07-15T18:16:11.17106713Z",
83+
"is_permanent": false
6684
}
6785
}
6886
"#;

src/eventsub/channel/unban.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub struct ChannelUnbanV1Payload {
3737
pub user_login: types::UserName,
3838
/// The user display name for the user who was unbanned on the specified channel.
3939
pub user_name: types::DisplayName,
40+
/// The user ID of the issuer of the unban.
41+
pub moderator_user_id: types::UserId,
42+
/// The user login of the issuer of the unban.
43+
pub moderator_user_login: types::UserName,
44+
/// The user name of the issuer of the unban.
45+
pub moderator_user_name: types::DisplayName,
4046
}
4147

4248
#[test]
@@ -62,7 +68,10 @@ fn parse_payload() {
6268
"user_name": "Cool_User",
6369
"broadcaster_user_id": "1337",
6470
"broadcaster_user_login": "cooler_user",
65-
"broadcaster_user_name": "Cooler_User"
71+
"broadcaster_user_name": "Cooler_User",
72+
"moderator_user_id": "1339",
73+
"moderator_user_login": "mod_user",
74+
"moderator_user_name": "Mod_User"
6675
}
6776
}
6877
"#;

0 commit comments

Comments
 (0)