
    i$i                    n   d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZmZmZmZ ddlmZmZmZmZ ddlmZ ddlmZ dd	lmZmZ er8dd
lmZ ddlmZmZ ddlm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z)m*Z+m,Z-m.Z/ ddl0m1Z1 dZ2 G d d          Z3 G d d          Z4 G d d          Z5 G d d          Z6dS )a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotationsN)
TYPE_CHECKINGAnyDictOptionalListSetUnionSequenceoverloadLiteral   )AutoModRuleTriggerTypeAutoModRuleActionTypeAutoModRuleEventTypetry_enum)AutoModPresets)utils)MISSINGcached_slot_property)Self)	SnowflakeGuildChannel)Thread)Guild)Member)ConnectionState)AutoModerationRuleAutoModerationTriggerMetadataAutoModerationActionAutoModerationActionExecution)Role)AutoModRuleActionAutoModTriggerAutoModRuleAutoModActionc                  B   e Zd ZdZdZeddd(d	            Zeddd)d            Zeddd*d            Zeddd+d            Zeddd,d            Zed-d            Zeddd.d            Zedddddd/d            Zdddddd/d Zd0d!Zed1d%            Z	d2d'Z
dS )3r#   a  Represents an auto moderation's rule action.

    .. note::
        Only one of ``channel_id``, ``duration``, or ``custom_message`` can be used.

    .. versionadded:: 2.0

    Attributes
    -----------
    type: :class:`AutoModRuleActionType`
        The type of action to take.
        Defaults to :attr:`~AutoModRuleActionType.block_message`.
    channel_id: Optional[:class:`int`]
        The ID of the channel or thread to send the alert message to, if any.
        Passing this sets :attr:`type` to :attr:`~AutoModRuleActionType.send_alert_message`.
    duration: Optional[:class:`datetime.timedelta`]
        The duration of the timeout to apply, if any.
        Has a maximum of 28 days.
        Passing this sets :attr:`type` to :attr:`~AutoModRuleActionType.timeout`.
    custom_message: Optional[:class:`str`]
        A custom message which will be shown to a user when their message is blocked.
        Passing this sets :attr:`type` to :attr:`~AutoModRuleActionType.block_message`.

        .. versionadded:: 2.2
    )type
channel_iddurationcustom_message.r)   r)   intreturnNonec                   d S N )selfr)   s     V/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/automod.py__init__zAutoModRuleAction.__init__W   s    :=#    r(   1Literal[AutoModRuleActionType.send_alert_message]c                   d S r1   r2   )r3   r(   r)   s      r4   r5   zAutoModRuleAction.__init__Z   s    svsvr6   r*   r*   datetime.timedeltac                   d S r1   r2   )r3   r*   s     r4   r5   zAutoModRuleAction.__init__]   s    GJsr6   &Literal[AutoModRuleActionType.timeout]c                   d S r1   r2   )r3   r(   r*   s      r4   r5   zAutoModRuleAction.__init__`   s    uxuxr6   )r+   r+   strc                   d S r1   r2   )r3   r+   s     r4   r5   zAutoModRuleAction.__init__c   s    >Acr6   ,Literal[AutoModRuleActionType.block_message]c                   d S r1   r2   )r3   r(   s     r4   r5   zAutoModRuleAction.__init__f   s    WZWZr6   Optional[str]c                   d S r1   r2   )r3   r(   r+   s      r4   r5   zAutoModRuleAction.__init__i   s	     sr6   Optional[AutoModRuleActionType]Optional[int]Optional[datetime.timedelta]c                   d S r1   r2   r3   r(   r)   r*   r+   s        r4   r5   zAutoModRuleAction.__init__n   s	     sr6   Nc                  t          d |||fD                       dk     rt          d          |  d | _        d | _        d | _        ||| _        n9|t          j        | _        n%|t          j        | _        nt          j	        | _        | j        t          j        u r|t          d          || _        | j        t          j        u r|t          d          || _        | j        t          j	        u r	|| _        d S d S )Nc              3     K   | ]}|d u V  	d S r1   r2   ).0vs     r4   	<genexpr>z-AutoModRuleAction.__init__.<locals>.<genexpr>   s&      IIQqDyIIIIIIr6      zBOnly one of channel_id, duration, or custom_message can be passed.z7channel_id cannot be None if type is send_alert_messagez.duration cannot be None set if type is timeout)
sum
ValueErrorr)   r*   r+   r(   r   send_alert_messagetimeoutblock_messagerH   s        r4   r5   zAutoModRuleAction.__init__x   s    II:x"HIIIIIAMMabbb()-6:-1DII#-@DII!-5DII-;DI9-@@@! !Z[[[(DO9-555 !QRRR$DM9-;;;"0D <;r6   c                B    d| j         j         d| j         d| j         dS )Nz<AutoModRuleAction type=z	 channel=z
 duration=>)r(   valuer)   r*   r3   s    r4   __repr__zAutoModRuleAction.__repr__   s-    o$)/ooDOoo_c_loooor6   dataAutoModerationActionPayloadr   c                   |d         t           j        j        k    r-|d         d         } | t          j        |                    S |d         t           j        j        k    r't          |d         d                   } | |          S |d         t           j        j        k    r@|                    di                               d          } | t           j        |	          S  | t           j	        
          S )Nr(   metadataduration_seconds)secondsr9   r)   r,   r+   )r(   r+   r(   )
r   rR   rV   datetime	timedeltarQ   r-   rS   getblock_member_interactions)clsrY   r]   r)   r+   s        r4   	from_datazAutoModRuleAction.from_data   s    <08>>>#J/0BC3 2;K L L LMMMM&\2EKKKT*-l;<<J3*----&\2@FFF!XXj"5599:JKKN31?P^____s-GHHHHr6   Dict[str, Any]c                H   | j         j        i d}| j         t          j        u r| j        d| j        i|d<   nk| j         t          j        u r,dt          | j                                                  i|d<   n,| j         t          j	        u rdt          | j                  i|d<   |S )N)r(   r\   r+   r\   r]   r)   )r(   rV   r   rS   r+   rR   r-   r*   total_secondsrQ   r>   r)   r3   rets     r4   to_dictzAutoModRuleAction.to_dict   s    yB779-;;;@S@_/1DEC
OOY/77713t}7R7R7T7T3U3UVC
OOY/BBB+S-A-ABC
O
r6   )r)   r-   r.   r/   )r(   r7   r)   r-   r.   r/   )r*   r:   r.   r/   )r(   r<   r*   r:   r.   r/   )r+   r>   r.   r/   )r(   r@   r.   r/   )r(   r@   r+   rB   r.   r/   )
r(   rD   r)   rE   r*   rF   r+   rB   r.   r/   r.   r>   )rY   rZ   r.   r   )r.   rf   )__name__
__module____qualname____doc__	__slots__r   r5   rX   classmethodre   rk   r2   r6   r4   r#   r#   :   s        4 EI,/===== X=ehvvvvv Xv9<JJJJJ XJgjxxxxx Xx03AAAAA XAZZZ XZeh     X  14$'14(+     X 15$(15(,$1 $1 $1 $1 $1 $1Lp p p p I I I [I     r6   r#   c                  X    e Zd ZdZdZddddddddddZddZedd            ZddZ	dS ) r$   a(  Represents a trigger for an auto moderation rule.

    The following table illustrates relevant attributes for each :class:`AutoModRuleTriggerType`:

    +-----------------------------------------------+------------------------------------------------+
    |                    Type                       |                   Attributes                   |
    +===============================================+================================================+
    | :attr:`AutoModRuleTriggerType.keyword`        | :attr:`keyword_filter`, :attr:`regex_patterns`,|
    |                                               | :attr:`allow_list`                             |
    +-----------------------------------------------+------------------------------------------------+
    | :attr:`AutoModRuleTriggerType.spam`           |                                                |
    +-----------------------------------------------+------------------------------------------------+
    | :attr:`AutoModRuleTriggerType.keyword_preset` | :attr:`presets`\, :attr:`allow_list`           |
    +-----------------------------------------------+------------------------------------------------+
    | :attr:`AutoModRuleTriggerType.mention_spam`   | :attr:`mention_limit`,                         |
    |                                               | :attr:`mention_raid_protection`                |
    +-----------------------------------------------+------------------------------------------------+
    | :attr:`AutoModRuleTriggerType.member_profile` | :attr:`keyword_filter`, :attr:`regex_patterns`,|
    |                                               | :attr:`allow_list`                             |
    +-----------------------------------------------+------------------------------------------------+

    .. versionadded:: 2.0

    Attributes
    -----------
    type: :class:`AutoModRuleTriggerType`
        The type of trigger.
    keyword_filter: List[:class:`str`]
        The list of strings that will trigger the filter.
        Maximum of 1000. Keywords can only be up to 60 characters in length.

        This could be combined with :attr:`regex_patterns`.
    regex_patterns: List[:class:`str`]
        The regex pattern that will trigger the filter. The syntax is based off of
        `Rust's regex syntax <https://docs.rs/regex/latest/regex/#syntax>`_.
        Maximum of 10. Regex strings can only be up to 260 characters in length.

        This could be combined with :attr:`keyword_filter` and/or :attr:`allow_list`

        .. versionadded:: 2.1
    presets: :class:`AutoModPresets`
        The presets used with the preset keyword filter.
    allow_list: List[:class:`str`]
        The list of words that are exempt from the commonly flagged words. Maximum of 100.
        Keywords can only be up to 60 characters in length.
    mention_limit: :class:`int`
        The total number of user and role mentions a message can contain.
        Has a maximum of 50.
    mention_raid_protection: :class:`bool`
        Whether mention raid protection is enabled or not.

        .. versionadded:: 2.4
    )r(   keyword_filterpresets
allow_listmention_limitregex_patternsmention_raid_protectionNr(    Optional[AutoModRuleTriggerType]rt   Optional[List[str]]ru   Optional[AutoModPresets]rv   rw   rE   rx   ry   Optional[bool]r.   r/   c                  |p|||p|f}|,t          d |D                       dk    rt          d          ||| _        nO||t          j        | _        n9|t          j        | _        n%||t          j        | _        nt          d          ||ng | _        ||nt                      | _	        ||ng | _
        ||nd| _        ||nd| _        ||ng | _        d S )Nc              3     K   | ]}|d uV  	d S r1   r2   )rK   args     r4   rM   z*AutoModTrigger.__init__.<locals>.<genexpr>  s&      GGC4GGGGGGr6   r   ziPlease pass only one of keyword_filter/regex_patterns, presets, or mention_limit/mention_raid_protection.zPlease pass the trigger type explicitly if not using keyword_filter, regex_patterns, presets, mention_limit, or mention_raid_protection.r   F)rO   rP   r(   r   keywordkeyword_presetmention_spamrt   r   ru   rv   rw   ry   rx   )	r3   r(   rt   ru   rv   rw   rx   ry   unique_argss	            r4   r5   zAutoModTrigger.__init__   s9    &7-BjSjk<CGG;GGGGG!KK{   DII'>+E.6DII .=DII&*A*M.;DII [   <J;U[]292Eww>K[K[3=3IZZr3@3L--RSH_Hk-D-Dqv$;I;U[]r6   r>   c                    |                                  }|r?d                    d |                                D                       }d| j         d| dS d| j         dS )N c              3  *   K   | ]\  }}| d |V  dS )=Nr2   )rK   krL   s      r4   rM   z*AutoModTrigger.__repr__.<locals>.<genexpr>#  s0      DDtq!llQllDDDDDDr6   z<AutoModTrigger type=rU   )to_metadata_dictjoinitemsr(   )r3   rY   joineds      r4   rX   zAutoModTrigger.__repr__   sr    $$&& 	AXXDDtzz||DDDDDF@49@@v@@@@3ty3333r6   r-   rY   .Optional[AutoModerationTriggerMetadataPayload]r   c           	     R   t          t          |          }| | |          S |t          j        t          j        fv rH | ||                    d          |                    d          |                    d                    S |t          j        u rG | |t          j        |                    dg                     |                    d                    S |t          j        u r4 | ||                    d          |                    d	          
          S  | |          S )Nr_   rt   rx   rv   )r(   rt   rx   rv   ru   )r(   ru   rv   mention_total_limitmention_raid_protection_enabled)r(   rw   ry   )	r   r   r   member_profilerb   r   r   _from_valuer   )rd   r(   rY   type_s       r4   re   zAutoModTrigger.from_data(  sD   /66<3E???"-57M7\]]]3#xx(899#xx(89988L11	    ,;;;3N$>txx	SU?V?V$W$Wdhdldlmydzdz    ,9993"hh'<==(,1R(S(S    3E???"r6   Optional[Dict[str, Any]]c                   | j         t          j        t          j        fv r| j        | j        | j        dS | j         t          j        u r!| j        	                                | j        dS | j         t          j
        u r| j        | j        dS d S )N)rt   rx   rv   )ru   rv   )r   r   )r(   r   r   r   rt   rx   rv   r   ru   to_arrayr   rw   ry   rW   s    r4   r   zAutoModTrigger.to_metadata_dictA  s    9/79O9^___"&"5"&"5"o  
 Y0???#|4466doVVVY0==='+'9373O   >=r6   )r(   rz   rt   r{   ru   r|   rv   r{   rw   rE   rx   r{   ry   r}   r.   r/   rl   )r(   r-   rY   r   r.   r   )r.   r   )
rm   rn   ro   rp   rq   r5   rX   rr   re   r   r2   r6   r4   r$   r$      s        4 4lI 26.2,0*.'+.226#^ #^ #^ #^ #^ #^J4 4 4 4 # # # [#0     r6   r$   c            	          e Zd ZdZdZd/dZd0dZd1dZed2d            Z	 e
d          d3d            Z e
d          d4d            Z e
d          d5d            Zd6dZeeeeeeeedd7d+Zed,d8d-Zd.S )9r%   a
  Represents an auto moderation rule.

    .. versionadded:: 2.0

    Attributes
    -----------
    id: :class:`int`
        The ID of the rule.
    guild: :class:`Guild`
        The guild the rule is for.
    name: :class:`str`
        The name of the rule.
    creator_id: :class:`int`
        The ID of the user that created the rule.
    trigger: :class:`AutoModTrigger`
        The rule's trigger.
    enabled: :class:`bool`
        Whether the rule is enabled.
    exempt_role_ids: Set[:class:`int`]
        The IDs of the roles that are exempt from the rule.
    exempt_channel_ids: Set[:class:`int`]
        The IDs of the channels that are exempt from the rule.
    event_type: :class:`AutoModRuleEventType`
        The type of event that will trigger the the rule.
    )_state_cs_exempt_roles_cs_exempt_channels_cs_actionsidguildname
creator_id
event_typetriggerenabledexempt_role_idsexempt_channel_ids_actionsrY   AutoModerationRulePayloadr   r   stater   r.   r/   c                  || _         || _        t          |d                   | _        |d         | _        t          |d                   | _        t          t          |d                   | _        t          
                    |d         |                    d                    | _        |d         | _        d	 |d
         D             | _        d |d         D             | _        |d         | _        d S )Nr   r   r   r   trigger_typetrigger_metadata)rY   r   c                ,    h | ]}t          |          S r2   r-   rK   role_ids     r4   	<setcomp>z'AutoModRule.__init__.<locals>.<setcomp>  s    )[)[)[7#g,,)[)[)[r6   exempt_rolesc                ,    h | ]}t          |          S r2   r   rK   r)   s     r4   r   z'AutoModRule.__init__.<locals>.<setcomp>  s    ,g,g,gS__,g,g,gr6   exempt_channelsactions)r   r   r-   r   r   r   r   r   r   r$   re   rb   r   r   r   r   r   )r3   rY   r   r   s       r4   r5   zAutoModRule.__init__}  s    ',!
4:f	d<011089MtT`Oa0b0b'5'?'?^@T[_[c[cdv[w[w'?'x'x!)_)[)[d>FZ)[)[)[,g,gtTeOf,g,g,g;?	?r6   r>   c                8    d| j          d| j        d| j        dS )Nz<AutoModRule id=z name=z guild=rU   )r   r   r   rW   s    r4   rX   zAutoModRule.__repr__  s)    T$'TTTTTZTTTTr6   c                f   t          | j                  t          | j        j                  | j        t          | j                  | j        j        | j        j        j        | j        	                                d | j
        D             | j        d | j        D             d | j        D             d}|S )Nc                6    g | ]}|                                 S r2   rk   rK   actions     r4   
<listcomp>z'AutoModRule.to_dict.<locals>.<listcomp>  s"    DDDV((DDDr6   c                ,    g | ]}t          |          S r2   r>   r   s     r4   r   z'AutoModRule.to_dict.<locals>.<listcomp>  s    NNNgS\\NNNr6   c                ,    g | ]}t          |          S r2   r   r   s     r4   r   z'AutoModRule.to_dict.<locals>.<listcomp>  s    ZZZJJZZZr6   )r   guild_idr   r   r   r   r   r   r   r   r   )r>   r   r   r   r   r   rV   r   r(   r   r   r   r   r   ri   s     r4   rk   zAutoModRule.to_dict  s    dg,,DJM**Ido..// L-3 $ = = ? ?DDt|DDD|NN9MNNNZZ$BYZZZ*
 *
 
r6   Optional[Member]c                @    | j                             | j                  S )z=Optional[:class:`Member`]: The member that created this rule.)r   
get_memberr   rW   s    r4   creatorzAutoModRule.creator  s     z$$T_555r6   r   
List[Role]c                    g }| j         j        }| j        D ]$} ||          }||                    |           %t	          j        |          S )z>List[:class:`Role`]: The roles that are exempt from this rule.)r   get_roler   appendr   _unique)r3   resultr   r   roles        r4   r   zAutoModRule.exempt_roles  s]     :&+ 	$ 	$G8G$$Dd###}V$$$r6   r   !List[Union[GuildChannel, Thread]]c                    t          dt          | j        j        | j                            }t          j        |          S )zeList[Union[:class:`abc.GuildChannel`, :class:`Thread`]]: The channels that are exempt from this rule.N)filtermapr   _resolve_channelr   r   r   )r3   its     r4   r   zAutoModRule.exempt_channels  s5     D#dj94;RSSTT}R   r6   r   List[AutoModRuleAction]c                $    d | j         D             S )zYList[:class:`AutoModRuleAction`]: The actions that are taken when this rule is triggered.c                B    g | ]}t                               |          S r2   )r#   re   r   s     r4   r   z'AutoModRule.actions.<locals>.<listcomp>  s'    PPP!++F33PPPr6   )r   rW   s    r4   r   zAutoModRule.actions  s     QP$-PPPPr6   objr   boolc               :    |j         | j        v p|j         | j        v S )a3  Check if an object is exempt from the automod rule.

        Parameters
        -----------
        obj: :class:`abc.Snowflake`
            The role, channel, or thread to check.

        Returns
        --------
        :class:`bool`
            Whether the object is exempt from the automod rule.
        )r   r   r   )r3   r   s     r4   	is_exemptzAutoModRule.is_exempt  s#     v00RCFd>R4RRr6   )r   r   r   r   r   r   r   reasonr   r   r   r   r   r$   r   r   Sequence[Snowflake]r   r   r   c                 K   i }	|t           urd |D             |	d<   |t           ur||	d<   |t           ur
|j        |	d<   |t           ur|                                }
|
|
|	d<   |t           ur||	d<   |t           urd |D             |	d	<   |t           urd
 |D             |	d<    | j        j        j        | j        j        | j        fd|i|	 d{V }|                     || j        | j                  S )a  |coro|

        Edits this auto moderation rule.

        You must have :attr:`Permissions.manage_guild` to edit rules.

        Parameters
        -----------
        name: :class:`str`
            The new name to change to.
        event_type: :class:`AutoModRuleEventType`
            The new event type to change to.
        actions: List[:class:`AutoModRuleAction`]
            The new rule actions to update.
        trigger: :class:`AutoModTrigger`
            The new trigger to update.
            You can only change the trigger metadata, not the type.
        enabled: :class:`bool`
            Whether the rule should be enabled or not.
        exempt_roles: Sequence[:class:`abc.Snowflake`]
            The new roles to exempt from the rule.
        exempt_channels: Sequence[:class:`abc.Snowflake`]
            The new channels to exempt from the rule.
        reason: :class:`str`
            The reason for updating this rule. Shows up on the audit log.

        Raises
        -------
        Forbidden
            You do not have permission to edit this rule.
        HTTPException
            Editing the rule failed.

        Returns
        --------
        :class:`AutoModRule`
            The updated auto moderation rule.
        c                6    g | ]}|                                 S r2   r   r   s     r4   r   z$AutoModRule.edit.<locals>.<listcomp>  s"    !I!I!Iv&.."2"2!I!I!Ir6   r   r   r   Nr   r   c                    g | ]	}|j         
S r2   r   rK   xs     r4   r   z$AutoModRule.edit.<locals>.<listcomp>  s    &B&B&Bqt&B&B&Br6   r   c                    g | ]	}|j         
S r2   r   r   s     r4   r   z$AutoModRule.edit.<locals>.<listcomp>  s    )H)H)H1!$)H)H)Hr6   r   r   rY   r   r   )	r   rV   r   r   httpedit_auto_moderation_ruler   r   	__class__)r3   r   r   r   r   r   r   r   r   payloadr   rY   s               r4   editzAutoModRule.edit  sa     d '!!!I!I!I!I!IGIw"GFOW$$$.$4GL!'!!&7799+.>*+'!!!(GIw&&&B&B\&B&B&BGN#')))H)H)H)H)HG%&?T[%?JMG
 
 
 	
 
 
 
 
 
 
 
 ~~4tz~MMMr6   r   c               x   K   | j         j                            | j        j        | j        |           d{V  dS )a  |coro|

        Deletes the auto moderation rule.

        You must have :attr:`Permissions.manage_guild` to delete rules.

        Parameters
        -----------
        reason: :class:`str`
            The reason for deleting this rule. Shows up on the audit log.

        Raises
        -------
        Forbidden
            You do not have permissions to delete the rule.
        HTTPException
            Deleting the rule failed.
        r   N)r   r   delete_auto_moderation_ruler   r   )r3   r   s     r4   deletezAutoModRule.delete  sG      & k::4:=$'Z`:aaaaaaaaaaar6   N)rY   r   r   r   r   r   r.   r/   rl   )r.   r   r.   r   )r.   r   )r.   r   )r.   r   )r   r   r.   r   )r   r>   r   r   r   r   r   r$   r   r   r   r   r   r   r   r>   r.   r   )r   r>   r.   r/   )rm   rn   ro   rp   rq   r5   rX   rk   propertyr   r   r   r   r   r   r   r   r   r2   r6   r4   r%   r%   Q  s        4I"K K K KU U U U   " 6 6 6 X6 ,--	% 	% 	% .-	% /00! ! ! 10!
 -((Q Q Q )(QS S S S$ +2+2"),3/6QN QN QN QN QN QNf -4 b b b b b b b br6   r%   c                  v    e Zd ZdZdZdd	ZddZedd            Zedd            Z	edd            Z
ddZdS )r&   a  Represents an action that was taken as the result of a moderation rule.

    .. versionadded:: 2.0

    Attributes
    -----------
    action: :class:`AutoModRuleAction`
        The action that was taken.
    message_id: Optional[:class:`int`]
        The message ID that triggered the action. This is only available if the
        action is done on an edited message.
    rule_id: :class:`int`
        The ID of the rule that was triggered.
    rule_trigger_type: :class:`AutoModRuleTriggerType`
        The trigger type of the rule that was triggered.
    guild_id: :class:`int`
        The ID of the guild where the rule was triggered.
    user_id: :class:`int`
        The ID of the user that triggered the rule.
    channel_id: :class:`int`
        The ID of the channel where the rule was triggered.
    alert_system_message_id: Optional[:class:`int`]
        The ID of the system message that was sent to the predefined alert channel.
    content: :class:`str`
        The content of the message that triggered the rule.
        Requires the :attr:`Intents.message_content` or it will always return an empty string.
    matched_keyword: Optional[:class:`str`]
        The matched keyword from the triggering message.
    matched_content: Optional[:class:`str`]
        The matched content from the triggering message.
        Requires the :attr:`Intents.message_content` or it will always return ``None``.
    )r   r   rule_idrule_trigger_typer   user_idr)   
message_idalert_system_message_idcontentmatched_keywordmatched_contentrY   $AutoModerationActionExecutionPayloadr   r   r.   r/   c               Z   || _         t          j        |d          | _        t                              |d                   | _        t          |d                   | _        t          t          |d                   | _        t          |d                   | _        t          j        |d          | _        t          |d                   | _        t          j        |d          | _        |                    d	d
          | _        |d         | _        |                    d          | _        d S )Nr   r   r   r   r   r)   r   r   r    r   r   )r   r   _get_as_snowflaker   r#   re   r   r-   r   r   r   r   r   r)   r   r   rb   r   r   r   )r3   rY   r   s      r4   r5   zAutoModAction.__init__c  s    ',).)@|)T)T):)D)DT(^)T)TY009ABXZ^_rZs9t9t j!122).)@|)T)TY006;6MdTm6n6n$ HHY33.23D.E.2hh7H.I.Ir6   r>   c                (    d| j          d| j        dS )Nz<AutoModRuleExecution rule_id=z action=rU   )r   r   rW   s    r4   rX   zAutoModAction.__repr__q  s    VVVdkVVVVr6   r   c                @    | j                             | j                  S )z3:class:`Guild`: The guild this action was taken in.)r    _get_or_create_unavailable_guildr   rW   s    r4   r   zAutoModAction.guildt  s     {;;DMJJJr6   %Optional[Union[GuildChannel, Thread]]c                R    | j         r| j                            | j                   S dS )zbOptional[Union[:class:`abc.GuildChannel`, :class:`Thread`]]: The channel this action was taken in.N)r)   r   get_channel_or_threadrW   s    r4   channelzAutoModAction.channely  s,     ? 	E:33DODDDtr6   r   c                @    | j                             | j                  S )z]Optional[:class:`Member`]: The member this action was taken against /who triggered this rule.)r   r   r   rW   s    r4   memberzAutoModAction.member  s     z$$T\222r6   r%   c                   K   | j         j                            | j        j        | j                   d{V }t          || j        | j                   S )a  |coro|

        Fetch the rule whose action was taken.

        You must have :attr:`Permissions.manage_guild` to do this.

        Raises
        -------
        Forbidden
            You do not have permissions to view the rule.
        HTTPException
            Fetching the rule failed.

        Returns
        --------
        :class:`AutoModRule`
            The rule that was executed.
        Nr   )r   r   get_auto_moderation_ruler   r   r   r%   )r3   rY   s     r4   
fetch_rulezAutoModAction.fetch_rule  sS      ( [%>>tz}dl[[[[[[[[DJdkJJJJr6   N)rY   r   r   r   r.   r/   rl   )r.   r   )r.   r   r   )r.   r%   )rm   rn   ro   rp   rq   r5   rX   r   r   r  r  r  r2   r6   r4   r&   r&   2  s         BIJ J J JW W W W K K K XK    X 3 3 3 X3K K K K K Kr6   r&   )7rp   
__future__r   r`   typingr   r   r   r   r   r	   r
   r   r   r   enumsr   r   r   r   flagsr   r   r   r   r   typing_extensionsr   abcr   r   threadsr   r   r   r  r   r   r   types.automodr   r   r   $AutoModerationTriggerMetadataPayloadr    rZ   r!   r   r   r"   __all__r#   r$   r%   r&   r2   r6   r4   <module>r     s   0 # " " " " "  d d d d d d d d d d d d d d d d d d d d d d d d ` ` ` ` ` ` ` ` ` ` ` ` ! ! ! ! ! !       0 0 0 0 0 0 0 0 &&&&&&,,,,,,,,&&&&&&            } } } } } } } }@T T T T T T T Tn^b ^b ^b ^b ^b ^b ^b ^bBhK hK hK hK hK hK hK hK hK hKr6   