Method CreateAutoModerationRuleAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
CreateAutoModerationRuleAsync(string, DiscordRuleEventType, DiscordRuleTriggerType, DiscordRuleTriggerMetadata, IReadOnlyList<DiscordAutoModerationAction>, Optional<bool>, Optional<IReadOnlyList<DiscordRole>>, Optional<IReadOnlyList<DiscordChannel>>, string?)
Creates an auto-moderation rule in the guild.
public Task<DiscordAutoModerationRule> CreateAutoModerationRuleAsync(string name, DiscordRuleEventType eventType, DiscordRuleTriggerType triggerType, DiscordRuleTriggerMetadata triggerMetadata, IReadOnlyList<DiscordAutoModerationAction> actions, Optional<bool> enabled = default, Optional<IReadOnlyList<DiscordRole>> exemptRoles = default, Optional<IReadOnlyList<DiscordChannel>> exemptChannels = default, string? reason = null)
Parameters
name
stringThe rule name.
eventType
DiscordRuleEventTypeThe event in which the rule should be triggered.
triggerType
DiscordRuleTriggerTypeThe type of content which can trigger the rule.
triggerMetadata
DiscordRuleTriggerMetadataMetadata used to determine whether a rule should be triggered. This argument can be skipped depending eventType value.
actions
IReadOnlyList<DiscordAutoModerationAction>Actions that will execute after the trigger of the rule.
enabled
Optional<bool>Whether the rule is enabled or not.
exemptRoles
Optional<IReadOnlyList<DiscordRole>>Roles that will not trigger the rule.
exemptChannels
Optional<IReadOnlyList<DiscordChannel>>Channels which will not trigger the rule.
reason
stringReason for audit logs.
Returns
- Task<DiscordAutoModerationRule>
The created rule.