pub struct EditAutoModRule<'a> { /* private fields */ }
builder
only.Expand description
A builder for creating or editing guild AutoMod rules.
§Examples
See GuildId::create_automod_rule
for details.
Implementations§
Source§impl<'a> EditAutoModRule<'a>
impl<'a> EditAutoModRule<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Equivalent to Self::default
.
Sourcepub fn event_type(self, event_type: EventType) -> Self
pub fn event_type(self, event_type: EventType) -> Self
Set the event context the rule should be checked.
Sourcepub fn trigger(self, trigger: Trigger) -> Self
pub fn trigger(self, trigger: Trigger) -> Self
Set the type of content which can trigger the rule.
None: The trigger type can’t be edited after creation. Only its values.
Sourcepub fn actions(self, actions: Vec<Action>) -> Self
pub fn actions(self, actions: Vec<Action>) -> Self
Set the actions which will execute when the rule is triggered.
Sourcepub fn exempt_roles(
self,
roles: impl IntoIterator<Item = impl Into<RoleId>>,
) -> Self
pub fn exempt_roles( self, roles: impl IntoIterator<Item = impl Into<RoleId>>, ) -> Self
Set roles that should not be affected by the rule.
Maximum of 20.
Sourcepub fn exempt_channels(
self,
channels: impl IntoIterator<Item = impl Into<ChannelId>>,
) -> Self
pub fn exempt_channels( self, channels: impl IntoIterator<Item = impl Into<ChannelId>>, ) -> Self
Set channels that should not be affected by the rule.
Maximum of 50.
Sourcepub fn audit_log_reason(self, reason: &'a str) -> Self
pub fn audit_log_reason(self, reason: &'a str) -> Self
Sets the request’s audit log reason.
Trait Implementations§
Source§impl Builder for EditAutoModRule<'_>
Available on crate feature http
only.
impl Builder for EditAutoModRule<'_>
http
only.Source§fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates or edits an AutoMod Rule
in a guild. Providing a RuleId
will edit that
corresponding rule, otherwise a new rule will be created.
Note: Requires the Manage Guild permission.
§Errors
Returns Error::Http
if the current user lacks permission, or if invalid data is given.
Source§type Context<'ctx> = (GuildId, Option<RuleId>)
type Context<'ctx> = (GuildId, Option<RuleId>)
type Built = Rule
Source§impl<'a> Clone for EditAutoModRule<'a>
impl<'a> Clone for EditAutoModRule<'a>
Source§fn clone(&self) -> EditAutoModRule<'a>
fn clone(&self) -> EditAutoModRule<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for EditAutoModRule<'a>
impl<'a> Debug for EditAutoModRule<'a>
Source§impl Default for EditAutoModRule<'_>
impl Default for EditAutoModRule<'_>
Auto Trait Implementations§
impl<'a> Freeze for EditAutoModRule<'a>
impl<'a> RefUnwindSafe for EditAutoModRule<'a>
impl<'a> Send for EditAutoModRule<'a>
impl<'a> Sync for EditAutoModRule<'a>
impl<'a> Unpin for EditAutoModRule<'a>
impl<'a> UnwindSafe for EditAutoModRule<'a>
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
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)