pub struct AutoModerationRuleManager<'a, B: Backend> { /* private fields */ }Expand description
The auto moderation rules of one guild. Returned by Context::auto_moderation_rules.
The cache does not keep rules, so the djs-model Rule is returned. Every
method needs MANAGE_GUILD.
discord.js counterpart: AutoModerationRuleManager (guild.autoModerationRules).
Implementations§
Source§impl<'a, B: Backend> AutoModerationRuleManager<'a, B>
impl<'a, B: Backend> AutoModerationRuleManager<'a, B>
Sourcepub const fn guild_id(self) -> GuildId
pub const fn guild_id(self) -> GuildId
The guild these rules belong to.
discord.js counterpart: AutoModerationRuleManager#guild.
Sourcepub fn fetch(
self,
rule_id: AutoModerationRuleId,
) -> Fetch<Rule, impl Future<Output = Result<Rule, Error>> + Send + 'a>
pub fn fetch( self, rule_id: AutoModerationRuleId, ) -> Fetch<Rule, impl Future<Output = Result<Rule, Error>> + Send + 'a>
A rule (Get Auto Moderation Rule).
discord.js counterpart: AutoModerationRuleManager#fetch(id).
§Errors
Returns the REST error if the request failed.
Sourcepub async fn list(self) -> Result<Collection<AutoModerationRuleId, Rule>, Error>
pub async fn list(self) -> Result<Collection<AutoModerationRuleId, Rule>, Error>
Every rule of the guild (List Auto Moderation Rules for Guild).
discord.js counterpart: AutoModerationRuleManager#fetch().
§Errors
Returns the REST error if the request failed.
Sourcepub async fn create(
self,
body: &CreateAutoModerationRule,
reason: Option<&str>,
) -> Result<Rule, Error>
pub async fn create( self, body: &CreateAutoModerationRule, reason: Option<&str>, ) -> Result<Rule, Error>
Creates a rule (Create Auto Moderation Rule).
discord.js counterpart: AutoModerationRuleManager#create.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn edit(
self,
rule_id: AutoModerationRuleId,
body: &ModifyAutoModerationRule,
reason: Option<&str>,
) -> Result<Rule, Error>
pub async fn edit( self, rule_id: AutoModerationRuleId, body: &ModifyAutoModerationRule, reason: Option<&str>, ) -> Result<Rule, Error>
Edits a rule (Modify Auto Moderation Rule).
discord.js counterpart: AutoModerationRuleManager#edit.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn delete(
self,
rule_id: AutoModerationRuleId,
reason: Option<&str>,
) -> Result<(), Error>
pub async fn delete( self, rule_id: AutoModerationRuleId, reason: Option<&str>, ) -> Result<(), Error>
Deletes a rule (Delete Auto Moderation Rule).
discord.js counterpart: AutoModerationRuleManager#delete.
§Errors
Returns the REST error if the request failed.
Trait Implementations§
Source§impl<B: Backend> Clone for AutoModerationRuleManager<'_, B>
impl<B: Backend> Clone for AutoModerationRuleManager<'_, B>
impl<B: Backend> Copy for AutoModerationRuleManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for AutoModerationRuleManager<'a, B>
impl<'a, B> !UnwindSafe for AutoModerationRuleManager<'a, B>
impl<'a, B> Freeze for AutoModerationRuleManager<'a, B>
impl<'a, B> Send for AutoModerationRuleManager<'a, B>
impl<'a, B> Sync for AutoModerationRuleManager<'a, B>
impl<'a, B> Unpin for AutoModerationRuleManager<'a, B>
impl<'a, B> UnsafeUnpin for AutoModerationRuleManager<'a, B>
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more