Skip to content

AutomoderationRule

Implementation of a discord automoderation rule object as a luau builder.

https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object

Properties

The AutomoderationRule instance has no set properties!

Methods

The AutomoderationRule instance has no set methods!

Functions

setName

AutomoderationRule . setName (

     self: AutomoderationRule
     name: string
)  -> ()

Sets the name of the automoderation rule.

setEventType

AutomoderationRule . setEventType (

     self: AutomoderationRule
     eventType: apiTypes.EventTypes
)  -> ()

Sets the event type for the automoderation rule.

setTriggerType

AutomoderationRule . setTriggerType (

     self: AutomoderationRule
     triggerType: apiTypes.TriggerTypes
)  -> ()

Sets the trigger type for the automoderation rule.

setTriggerMetadata

AutomoderationRule . setTriggerMetadata (

     self: AutomoderationRule
     triggerMetadata: triggerMetadata.JSON
)  -> ()

Sets the trigger metadata for the automoderation rule.

setActions

AutomoderationRule . setActions (

     self: AutomoderationRule
     actions: { action.JSON }
)  -> ()

Sets the actions for the automoderation rule.

setEnabled

AutomoderationRule . setEnabled (

     self: AutomoderationRule
     enabled: boolean
)  -> ()

Sets whether the automoderation rule is enabled.

setExemptRoles

AutomoderationRule . setExemptRoles (

     self: AutomoderationRule
     exemptRoles: { apiTypes.Snowflake }
)  -> ()

Sets the exempt roles for the automoderation rule.

setExemptChannels

AutomoderationRule . setExemptChannels (

     self: AutomoderationRule
     exemptChannels: { apiTypes.Snowflake }
)  -> ()

Sets the exempt channels for the automoderation rule.

build

AutomoderationRule . build (

     self: AutomoderationRule
)  -> ()

Builds the automoderation rule object.

new

AutomoderationRule . new (

     resource: {
       name: string?,
       eventType: apiTypes.EventTypes?,
       triggerType: apiTypes.TriggerTypes?,
       triggerMetadata: triggerMetadata.JSON?,
       actions: { action.JSON,
    }
)  -> ()

Constructs a new automoderation rule builder.

local rule = AutomoderationRule.new({
name = "My Rule",
eventType = "MESSAGE_SEND",
triggerType = "KEYWORD",
actions = {
{
type = "BLOCK_MESSAGE",
metadata = {}
}
}
})