Table of Contents

Method CreateGuildAutoModerationRuleAsync

Namespace
DSharpPlus.Net
Assembly
DSharpPlus.dll

CreateGuildAutoModerationRuleAsync(ulong, string, DiscordRuleEventType, DiscordRuleTriggerType, DiscordRuleTriggerMetadata, IReadOnlyList<DiscordAutoModerationAction>, Optional<bool>, Optional<IReadOnlyList<DiscordRole>>, Optional<IReadOnlyList<DiscordChannel>>, string?)

Internal method to create an auto-moderation rule in a guild.

public ValueTask<DiscordAutoModerationRule> CreateGuildAutoModerationRuleAsync(ulong guildId, 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

guildId ulong

The id of the guild where the rule will be created.

name string

The rule name.

eventType DiscordRuleEventType

The Discord event that will trigger the rule.

triggerType DiscordRuleTriggerType

The rule trigger.

triggerMetadata DiscordRuleTriggerMetadata

The trigger metadata.

actions IReadOnlyList<DiscordAutoModerationAction>

The actions that will run when a rule is triggered.

enabled Optional<bool>

Whenever the rule is enabled or not.

exemptRoles Optional<IReadOnlyList<DiscordRole>>

The exempted roles that will not trigger the rule.

exemptChannels Optional<IReadOnlyList<DiscordChannel>>

The exempted channels that will not trigger the rule.

reason string

The reason for audits logs.

Returns

ValueTask<DiscordAutoModerationRule>

The created rule.