diff options
| author | Adelyn Breedlove <[email protected]> | 2019-12-09 15:54:09 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-12-09 15:54:09 -0700 |
| commit | 1645765c0e8ab5cdae75a0b6fbad624413feaae4 (patch) | |
| tree | 0e8b1399968dcbcf2e482763f22368b979d93005 /src | |
| parent | Merge branch 'aliases-fix' (diff) | |
| download | serenity-1645765c0e8ab5cdae75a0b6fbad624413feaae4.tar.xz serenity-1645765c0e8ab5cdae75a0b6fbad624413feaae4.zip | |
Add new auditlog type enums
Diffstat (limited to 'src')
| -rw-r--r-- | src/model/guild/audit_log.rs | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/src/model/guild/audit_log.rs b/src/model/guild/audit_log.rs index e4a344c..11fd283 100644 --- a/src/model/guild/audit_log.rs +++ b/src/model/guild/audit_log.rs @@ -25,6 +25,7 @@ pub enum Target { Invite = 50, Webhook = 60, Emoji = 70, + Integration = 80, } /// Determines the action that was done on a target. @@ -38,7 +39,8 @@ pub enum Action { Invite(ActionInvite), Webhook(ActionWebhook), Emoji(ActionEmoji), - MessageDelete, + Message(ActionMessage), + Integration(ActionIntegration), } impl Action { @@ -54,7 +56,8 @@ impl Action { Action::Invite(ref x) => x.num(), Action::Webhook(ref x) => x.num(), Action::Emoji(ref x) => x.num(), - Action::MessageDelete => 72, + Action::Message(ref x) => x.num(), + Action::Integration(ref x) => x.num(), } } } @@ -104,6 +107,9 @@ pub enum ActionMember { BanRemove = 23, Update = 24, RoleUpdate = 25, + MemberMove = 26, + MemberDisconnect = 27, + BotAdd = 28, } impl ActionMember { @@ -115,6 +121,9 @@ impl ActionMember { ActionMember::BanRemove => 23, ActionMember::Update => 24, ActionMember::RoleUpdate => 25, + ActionMember::MemberMove => 26, + ActionMember::MemberDisconnect => 27, + ActionMember::BotAdd => 28, } } } @@ -191,6 +200,51 @@ impl ActionEmoji { } } +#[derive(Debug)] +#[repr(u8)] +pub enum ActionMessage { + Delete = 72, + BulkDelete = 73, + Pin = 74, + Unpin = 75, + #[doc(hidden)] + __Nonexhaustive, +} + +impl ActionMessage { + pub fn num(&self) -> u8 { + match *self { + ActionMessage::Delete => 72, + ActionMessage::BulkDelete => 73, + ActionMessage::Pin => 74, + ActionMessage::Unpin => 75, + ActionMessage::__Nonexhaustive => unreachable!(), + } + } +} + + +#[derive(Debug)] +#[repr(u8)] +pub enum ActionIntegration { + Create = 80, + Update = 81, + Delete = 82, + #[doc(hidden)] + __Nonexhaustive, +} + +impl ActionIntegration { + pub fn num(&self) -> u8 { + match *self { + ActionIntegration::Create => 80, + ActionIntegration::Update => 81, + ActionIntegration::Delete => 82, + ActionIntegration::__Nonexhaustive => unreachable!(), + } + } +} + #[derive(Debug, Deserialize, Serialize)] pub struct Change { #[serde(rename = "key")] pub name: String, @@ -348,14 +402,15 @@ mod action_handler { Ok(match value { 1 => Action::GuildUpdate, - 10...12 => Action::Channel(unsafe { transmute(value) }), - 13...15 => Action::ChannelOverwrite(unsafe { transmute(value) }), - 20...25 => Action::Member(unsafe { transmute(value) }), - 30...32 => Action::Role(unsafe { transmute(value) }), - 40...42 => Action::Invite(unsafe { transmute(value) }), - 50...52 => Action::Webhook(unsafe { transmute(value) }), - 60...62 => Action::Emoji(unsafe { transmute(value) }), - 72 => Action::MessageDelete, + 10..=12 => Action::Channel(unsafe { transmute(value) }), + 13..=15 => Action::ChannelOverwrite(unsafe { transmute(value) }), + 20..=28 => Action::Member(unsafe { transmute(value) }), + 30..=32 => Action::Role(unsafe { transmute(value) }), + 40..=42 => Action::Invite(unsafe { transmute(value) }), + 50..=52 => Action::Webhook(unsafe { transmute(value) }), + 60..=62 => Action::Emoji(unsafe { transmute(value) }), + 72..=75 => Action::Message(unsafe { transmute(value) }), + 80..=82 => Action::Integration(unsafe { transmute(value) }), _ => return Err(E::custom(format!("Unexpected action number: {}", value))), }) } |