Rule
Implementation of a discord automoderation rule object as a luau builder.
https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
Summary
Properties
Rule.name :: stringRule.eventType :: Builders.EventTypesRule.triggerType :: Builders.TriggerTypesRule.triggerMetadata :: Builders.AutoModeration.TriggerMetadataRule.actions :: {Builders.AutoModeration.Action}Rule.enabled :: booleanRule.exemptRoles :: {string}Rule.exemptChannels :: {string}Methods
Rule:setName(name: string) → AutomoderationRuleRule:setEventType(eventType: apiTypes.EventTypes) → AutomoderationRuleRule:setTriggerType(triggerType: apiTypes.TriggerTypes) → AutomoderationRuleRule:setTriggerMetadata(triggerMetadata: triggerMetadata.JSON) → AutomoderationRuleRule:setActions(actions: { action.JSON }) → AutomoderationRuleRule:setEnabled(enabled: boolean) → AutomoderationRuleRule:setExemptRoles(exemptRoles: { apiTypes.Snowflake }) → AutomoderationRuleRule:setExemptChannels(exemptChannels: { apiTypes.Snowflake }) → AutomoderationRuleRule:build() → JSONProperties
Section titled “Properties”The name of the automoderation rule.
eventType
Section titled “eventType”The event type that will trigger the rule.
triggerType
Section titled “triggerType”The type of content which can trigger the rule.
triggerMetadata
Section titled “triggerMetadata”The trigger metadata for the rule.
actions
Section titled “actions”The actions which will execute when the rule is triggered.
enabled
Section titled “enabled”Whether the rule is enabled.
exemptRoles
Section titled “exemptRoles”The role ids that should not be affected by the rule.
exemptChannels
Section titled “exemptChannels”The channel ids that should not be affected by the rule.
Methods
Section titled “Methods”setName
Section titled “setName”Rule : setName ( name ) -> AutomoderationRule
Sets the name of the automoderation rule.
Parameters
| name: string |
Returns
| AutomoderationRule |
setEventType
Section titled “setEventType”Rule : setEventType ( eventType ) -> AutomoderationRule
Sets the event type for the automoderation rule.
Parameters
| eventType: EventTypes |
Returns
| AutomoderationRule |
setTriggerType
Section titled “setTriggerType”Rule : setTriggerType ( triggerType ) -> AutomoderationRule
Sets the trigger type for the automoderation rule.
Parameters
| triggerType: TriggerTypes |
Returns
| AutomoderationRule |
setTriggerMetadata
Section titled “setTriggerMetadata”Rule : setTriggerMetadata ( triggerMetadata ) -> AutomoderationRule
Sets the trigger metadata for the automoderation rule.
Parameters
| triggerMetadata: JSON |
Returns
| AutomoderationRule |
setActions
Section titled “setActions”Rule : setActions ( actions ) -> AutomoderationRule
Sets the actions for the automoderation rule.
Parameters
| actions: JSON } |
Returns
| AutomoderationRule |
setEnabled
Section titled “setEnabled”Rule : setEnabled ( enabled ) -> AutomoderationRule
Sets whether the automoderation rule is enabled.
Parameters
| enabled: boolean |
Returns
| AutomoderationRule |
setExemptRoles
Section titled “setExemptRoles”Rule : setExemptRoles ( exemptRoles ) -> AutomoderationRule
Sets the exempt roles for the automoderation rule.
Parameters
| exemptRoles: Snowflake } |
Returns
| AutomoderationRule |
setExemptChannels
Section titled “setExemptChannels”Rule : setExemptChannels ( exemptChannels ) -> AutomoderationRule
Sets the exempt channels for the automoderation rule.
Parameters
| exemptChannels: Snowflake } |
Returns
| AutomoderationRule |
Rule : build ( ) -> JSON
Builds the automoderation rule object.
Returns
| JSON |
Functions
Section titled “Functions”Rule . new ( resource ) -> AutomoderationRule
Constructs a new automoderation rule builder.
local rule = AutomoderationRule.new({ name = "My Rule", eventType = "MESSAGE_SEND", triggerType = "KEYWORD", actions = { { type = "BLOCK_MESSAGE", metadata = {} } }})Parameters
| resource: { name: string?, eventType: apiTypes.EventTypes?, triggerType: apiTypes.TriggerTypes?, triggerMetadata: triggerMetadata.JSON?, actions: { action.JSON, } |
Returns
| AutomoderationRule |