Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventSub housekeeping #455

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exclude = ["twitch_types", "twitch_oauth2"]
[workspace.dependencies]
twitch_api = { version = "0.7.0-rc.8", path = "." }
twitch_oauth2 = { version = "0.14.0", path = "twitch_oauth2/" }
twitch_types = { version = "0.4.7", features = [
twitch_types = { version = "0.4.8", features = [
"serde",
], path = "./twitch_types" }
ureq = { version = "2.10.1", default-features = false, features = [
Expand Down
5 changes: 1 addition & 4 deletions src/eventsub/automod/message/hold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,7 @@ fn parse_payload_v2_automod() {
let AutomodHeldReason::Automod { automod } = &notif.reason else {
panic!("invalid held reason");
};
assert_eq!(
automod.category,
AutomodCategory::Unknown("swearing".to_string())
);
assert_eq!(automod.category, AutomodCategory::Swearing);
assert_eq!(automod.level, 4);
assert_eq!(
automod.boundaries,
Expand Down
5 changes: 1 addition & 4 deletions src/eventsub/automod/message/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,7 @@ fn parse_payload_v2_automod() {
let AutomodHeldReason::Automod { automod } = &notif.reason else {
panic!("invalid held reason");
};
assert_eq!(
automod.category,
AutomodCategory::Unknown("swearing".to_string())
);
assert_eq!(automod.category, AutomodCategory::Swearing);
assert_eq!(automod.level, 4);
assert_eq!(
automod.boundaries,
Expand Down
4 changes: 3 additions & 1 deletion src/eventsub/automod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ pub enum AutomodCategory {
Misogyny,
/// Racist language or behavior.
Racism,
/// Profane language or swearing.
/// Profane language.
Profanity,
/// Use of swear words or expletives.
Swearing,
/// An unknown category identified by Automod, contains the raw string provided by Twitch.
#[serde(untagged)]
Unknown(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub struct ChannelPointsCustomRewardRemoveV1Payload {
/// The requested broadcaster login.
pub broadcaster_user_login: types::UserName,
/// The requested broadcaster display name.
pub broadcaster_user_name: types::UserName,
pub broadcaster_user_name: types::DisplayName,
/// Timestamp of the cooldown expiration. null if the reward isn’t on cooldown.
pub cooldown_expires_at: Option<types::Timestamp>,
/// The reward cost.
Expand Down
8 changes: 4 additions & 4 deletions src/eventsub/channel/chat/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ pub struct ChannelChatMessageV1Payload {
/// The broadcaster user ID.
pub broadcaster_user_id: types::UserId,
/// The broadcaster display name.
pub broadcaster_user_name: types::UserName,
pub broadcaster_user_name: types::DisplayName,
/// The broadcaster login.
pub broadcaster_user_login: types::UserName,
/// The user ID of the user that sent the message.
pub chatter_user_id: types::UserId,
/// The user name of the user that sent the message.
pub chatter_user_name: types::UserName,
pub chatter_user_name: types::DisplayName,
/// The user login of the user that sent the message.
pub chatter_user_login: types::UserName,
/// A UUID that identifies the message.
Expand Down Expand Up @@ -137,15 +137,15 @@ pub struct Reply {
/// User ID of the sender of the parent message.
pub parent_user_id: types::UserId,
/// User name of the sender of the parent message.
pub parent_user_name: types::UserName,
pub parent_user_name: types::DisplayName,
/// User login of the sender of the parent message.
pub parent_user_login: types::UserName,
/// An ID that identifies the parent message of the reply thread.
pub thread_message_id: types::MsgId,
/// User ID of the sender of the thread's parent message.
pub thread_user_id: types::UserId,
/// User name of the sender of the thread's parent message.
pub thread_user_name: types::UserName,
pub thread_user_name: types::DisplayName,
/// User login of the sender of the thread's parent message.
pub thread_user_login: types::UserName,
}
Expand Down
8 changes: 4 additions & 4 deletions src/eventsub/channel/subscription/end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ pub struct ChannelSubscriptionEndV1Payload {
/// The broadcaster user ID.
pub broadcaster_user_id: types::UserId,
/// The broadcaster login.
pub broadcaster_user_login: types::DisplayName,
pub broadcaster_user_login: types::UserName,
/// The broadcaster display name.
pub broadcaster_user_name: types::UserName,
pub broadcaster_user_name: types::DisplayName,
/// The user ID for the user whose subscription ended.
pub user_id: types::UserId,
/// The user login for the user whose subscription ended.
pub user_login: types::DisplayName,
pub user_login: types::UserName,
/// The user display name for the user whose subscription ended.
pub user_name: types::UserName,
pub user_name: types::DisplayName,
/// The tier of the subscription that ended. Valid values are 1000, 2000, and 3000.
pub tier: types::SubscriptionTier,
/// Whether the subscription was a gift.
Expand Down
8 changes: 4 additions & 4 deletions src/eventsub/channel/subscription/gift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ pub struct ChannelSubscriptionGiftV1Payload {
/// The broadcaster user ID.
pub broadcaster_user_id: types::UserId,
/// The broadcaster login.
pub broadcaster_user_login: types::DisplayName,
pub broadcaster_user_login: types::UserName,
/// The broadcaster display name.
pub broadcaster_user_name: types::UserName,
pub broadcaster_user_name: types::DisplayName,
/// The number of subscriptions gifted by this user in the channel. This value is null for anonymous gifts or if the gifter has opted out of sharing this information.
pub cumulative_total: Option<i64>,
/// Whether the subscription gift was anonymous.
Expand All @@ -54,9 +54,9 @@ pub struct ChannelSubscriptionGiftV1Payload {
/// The user ID of the user who sent the subscription gift. Set to null if it was an anonymous subscription gift.
pub user_id: Option<types::UserId>,
/// The user login of the user who sent the gift. Set to null if it was an anonymous subscription gift.
pub user_login: Option<types::DisplayName>,
pub user_login: Option<types::UserName>,
/// The user display name of the user who sent the gift. Set to null if it was an anonymous subscription gift.
pub user_name: Option<types::UserName>,
pub user_name: Option<types::DisplayName>,
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/eventsub/channel/subscription/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct SubscriptionMessage {
pub text: String,
/// An array that includes the emote ID and start and end positions for where the emote appears in the text.
#[serde(deserialize_with = "crate::deserialize_default_from_null")]
pub emotes: Vec<types::ResubscriptionEmote>,
pub emotes: Vec<types::EmoteOccurrence>,
}

#[cfg(test)]
Expand Down
Loading
Loading