#[non_exhaustive]pub struct ModifyAutoModerationRule {
pub name: Option<CompactString>,
pub event_type: Option<EventType>,
pub trigger_metadata: Option<TriggerMetadata>,
pub actions: Option<Vec<Action>>,
pub enabled: Option<bool>,
pub exempt_roles: Option<Vec<RoleId>>,
pub exempt_channels: Option<Vec<ChannelId>>,
}Expand description
The body of Modify Auto Moderation Rule.
Every field is optional; the trigger type cannot be changed. Lists replace the rule’s lists, so pass complete ones (an empty list clears it).
discord.js counterpart: the argument of AutoModerationRule#edit,
AutoModerationRuleManager#edit.
§Examples
use djs_model::{auto_moderation::Action, rest::ModifyAutoModerationRule};
let mut body = ModifyAutoModerationRule::default();
body.enabled = Some(false);
body.actions = Some(vec![Action::block_message(), Action::timeout(60)]);
assert_eq!(
serde_json::to_string(&body)?,
r#"{"actions":[{"type":1},{"type":3,"metadata":{"duration_seconds":60}}],"enabled":false}"#
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Option<CompactString>The new name.
event_type: Option<EventType>The new event type.
trigger_metadata: Option<TriggerMetadata>The new trigger settings. Start from the rule’s current
trigger_metadata to keep the
fields you do not change.
actions: Option<Vec<Action>>The new actions.
enabled: Option<bool>Whether the rule is enabled.
exempt_roles: Option<Vec<RoleId>>The new exempt roles (up to 20).
exempt_channels: Option<Vec<ChannelId>>The new exempt channels (up to 50).
Trait Implementations§
Source§impl Clone for ModifyAutoModerationRule
impl Clone for ModifyAutoModerationRule
Source§impl Debug for ModifyAutoModerationRule
impl Debug for ModifyAutoModerationRule
Source§impl Default for ModifyAutoModerationRule
impl Default for ModifyAutoModerationRule
impl Eq for ModifyAutoModerationRule
Source§impl PartialEq for ModifyAutoModerationRule
impl PartialEq for ModifyAutoModerationRule
Source§impl Serialize for ModifyAutoModerationRule
impl Serialize for ModifyAutoModerationRule
impl StructuralPartialEq for ModifyAutoModerationRule
Auto Trait Implementations§
impl Forget for ModifyAutoModerationRule
impl Freeze for ModifyAutoModerationRule
impl Move for ModifyAutoModerationRule
impl RefUnwindSafe for ModifyAutoModerationRule
impl Send for ModifyAutoModerationRule
impl Sync for ModifyAutoModerationRule
impl Unpin for ModifyAutoModerationRule
impl UnsafeUnpin for ModifyAutoModerationRule
impl UnwindSafe for ModifyAutoModerationRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more