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
ulongThe id of the guild where the rule will be created.
name
stringThe rule name.
eventType
DiscordRuleEventTypeThe Discord event that will trigger the rule.
triggerType
DiscordRuleTriggerTypeThe rule trigger.
triggerMetadata
DiscordRuleTriggerMetadataThe 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
stringThe reason for audits logs.
Returns
- ValueTask<DiscordAutoModerationRule>
The created rule.