module Discorb class AutoModRule < DiscordModel type trigger_type = :keyword | :harmful_link | :spam | :keyword_preset type preset_type = :profanity | :sexual_content | :slurs # @return [Hash{Integer => Symbol}] The mapping of trigger types. # @private TRIGGER_TYPES: Hash[Integer, trigger_type] # @return [Hash{Integer => Symbol}] The mapping of preset types. # @private PRESET_TYPES: Hash[Integer, preset_type] # @return [Hash{Integer => Symbol}] The mapping of event types. # @private EVENT_TYPES: Hash[Integer, :message_send] # @return [Discorb::Snowflake] The ID of the rule. attr_reader id: Discorb::Snowflake # @return [String] The name of the rule. attr_reader name: String # @return [Boolean] Whether the rule is enabled. attr_reader enabled: bool alias enabled? enabled # @return [Array] The actions of the rule. attr_reader actions: Array[Discorb::AutoModRule::Action] # @return [Array] The keywords that the rule is triggered by. # @note This is only available if the trigger type is `:keyword`. attr_reader keyword_filter: Array[String]? # @return [Symbol] Returns the type of the preset. # @note This is only available if the trigger type is `:keyword_preset`. def preset_type: -> preset_type # @return [Symbol] Returns the type of the trigger. def trigger_type: -> trigger_type # @return [Symbol] Returns the type of the event. def event_type: -> :message_send def creator: -> Discorb::Member def guild: -> Discorb::Guild def exempt_roles: -> Array[Discorb::Role] def exempt_channels: -> Array[Discorb::Channel] # # Initialize a new auto mod. # @private # # @param [Discorb::Client] client The client. # @param [Hash] data The auto mod data. def initialize: (Discorb::Client client, Discorb::json data) -> void # # Edit the rule. # @async # @edit # # @param [String] name The name of the rule. # @param [Symbol] event_type The event type of the rule. See {Discorb::AutoModRule::EVENT_TYPES}. # @param [Array] actions The actions of the rule. # @param [Boolean] enabled Whether the rule is enabled or not. # @param [Array] exempt_roles The roles that are exempt from the rule. # @param [Array] exempt_channels The channels that are exempt from the rule. # @param [Array] keyword_filter The keywords to filter. # @param [Symbol] presets The preset of the rule. See {Discorb::AutoModRule::PRESET_TYPES}. # @param [String] reason The reason for creating the rule. # # @return [Async::Task] The task. def edit: ( ?name: String, ?event_type: :send_message, ?actions: Array[Discorb::AutoModRule::Action], ?enabled: bool, ?exempt_roles: Array[Discorb::Role], ?exempt_channels: Array[Discorb::Channel], ?keyword_filter: Array[String]?, ?presets: :profanity | :sexual_content | :slurs, ?reason: nil ) -> Async::Task[void] # # Delete the rule. # # @param [String] reason The reason for deleting the rule. # # @return [Async::Task] The task. def delete!: (?reason: nil) -> Async::Task[void] class Action < Discorb::DiscordModel # @return [Hash{Integer => Symbol}] The mapping of action types. # @private ACTION_TYPES: Hash[Integer, Symbol] # @return [Symbol] Returns the type of the action. attr_reader type: :ban | :kick | :mute | :warn # @return [Integer] The duration of the timeout. # @note This is only available if the action type is `:timeout`. attr_reader duration_seconds: Integer? # # Initialize a new action. # # @param [Symbol] type The type of the action. # @param [Integer] duration_seconds The duration of the timeout. # This is only available if the action type is `:timeout`. # @param [Discorb::Channel] channel The channel that the alert message is sent to. # This is only available if the action type is `:send_alert_message`. def initialize: ( Symbol `type`, ?duration_seconds: Integer?, ?channel: Discorb::Channel? ) -> void # @return [Discorb::Channel] The channel that the alert message is sent to. # @note This is only available if the action type is `:send_alert_message`. def channel: -> Discorb::Channel? end end end