From 120160fa02f117e397e67e2e59c08be9b8932818 Mon Sep 17 00:00:00 2001 From: CamiKaseM7 Date: Sun, 12 Nov 2023 00:48:17 -0300 Subject: [PATCH 1/2] Add missing audit log events --- src/model/guild/audit_log/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/model/guild/audit_log/mod.rs b/src/model/guild/audit_log/mod.rs index f2f095d3a84..7f5f9be8f1f 100644 --- a/src/model/guild/audit_log/mod.rs +++ b/src/model/guild/audit_log/mod.rs @@ -35,6 +35,7 @@ pub enum Action { ScheduledEvent(ScheduledEventAction), Thread(ThreadAction), AutoMod(AutoModAction), + CreatorMonetization(CreatorMonetizationAction), VoiceChannelStatus(VoiceChannelStatusAction), Unknown(u8), } @@ -58,6 +59,7 @@ impl Action { Self::ScheduledEvent(x) => x as u8, Self::Thread(x) => x as u8, Self::AutoMod(x) => x as u8, + Self::CreatorMonetization(x) => x as u8, Self::VoiceChannelStatus(x) => x as u8, Self::Unknown(x) => x, } @@ -81,6 +83,7 @@ impl Action { 100..=102 => Action::ScheduledEvent(unsafe { transmute(value) }), 110..=112 => Action::Thread(unsafe { transmute(value) }), 140..=145 => Action::AutoMod(unsafe { transmute(value) }), + 150..=151 => Action::CreatorMonetization(unsafe { transmute(value) }), 192..=193 => Action::VoiceChannelStatus(unsafe { transmute(value) }), _ => Action::Unknown(value), } @@ -251,6 +254,15 @@ pub enum AutoModAction { UserCommunicationDisabled = 145, } +/// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). +#[derive(Copy, Clone, Debug)] +#[non_exhaustive] +#[repr(u8)] +pub enum CreatorMonetizationAction { + RequestCreated = 150, + TermsAccepted = 151, +} + /// [Incomplete documentation](https://github.com/discord/discord-api-docs/pull/6398) #[derive(Copy, Clone, Debug)] #[non_exhaustive] @@ -428,6 +440,12 @@ mod tests { assert_action!(Action::AutoMod(AutoModAction::RuleUpdate), 141); assert_action!(Action::AutoMod(AutoModAction::RuleDelete), 142); assert_action!(Action::AutoMod(AutoModAction::BlockMessage), 143); + assert_action!(Action::AutoMod(AutoModAction::FlagToChannel), 144); + assert_action!(Action::AutoMod(AutoModAction::UserCommunicationDisabled), 145); + assert_action!(Action::CreatorMonetization(CreatorMonetizationAction::RequestCreated), 150); + assert_action!(Action::CreatorMonetization(CreatorMonetizationAction::TermsAccepted), 151); + assert_action!(Action::VoiceChannelStatus(VoiceChannelStatusAction::StatusUpdate), 192); + assert_action!(Action::VoiceChannelStatus(VoiceChannelStatusAction::StatusDelete), 193); assert_action!(Action::Unknown(234), 234); } From 97912d9d24ab1124f5419779bd83ebe98c26a725 Mon Sep 17 00:00:00 2001 From: CamiKaseM7 Date: Sun, 12 Nov 2023 01:23:52 -0300 Subject: [PATCH 2/2] Remove whitespace to respect format --- src/model/guild/audit_log/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/guild/audit_log/mod.rs b/src/model/guild/audit_log/mod.rs index 7f5f9be8f1f..918b89656a3 100644 --- a/src/model/guild/audit_log/mod.rs +++ b/src/model/guild/audit_log/mod.rs @@ -260,7 +260,7 @@ pub enum AutoModAction { #[repr(u8)] pub enum CreatorMonetizationAction { RequestCreated = 150, - TermsAccepted = 151, + TermsAccepted = 151, } /// [Incomplete documentation](https://github.com/discord/discord-api-docs/pull/6398)