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
namestringThe rule name.
eventTypeDiscordRuleEventTypeThe event in which the rule should be triggered.
triggerTypeDiscordRuleTriggerTypeThe type of content which can trigger the rule.
triggerMetadataDiscordRuleTriggerMetadataMetadata used to determine whether a rule should be triggered. This argument can be skipped depending eventType value.
actionsIReadOnlyList<DiscordAutoModerationAction>Actions that will execute after the trigger of the rule.
enabledOptional<bool>Whether the rule is enabled or not.
exemptRolesOptional<IReadOnlyList<DiscordRole>>Roles that will not trigger the rule.
exemptChannelsOptional<IReadOnlyList<DiscordChannel>>Channels which will not trigger the rule.
reasonstringReason for audit logs.
Returns
- Task<DiscordAutoModerationRule>
The created rule.