Repository: Rapptz/discord.py
File: discord/automod.py (Python)

Code before:
    Attributes
    -----------
    type: :class:`AutoModRuleActionType`
        The type of action to take.

        .. versionchanged:: 2.3
            This is an optional parameter.
    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
    """

    __slots__ = ('type', 'channel_id', 'duration', 'custom_message')

    @overload
    def __init__(self, *, channel_id: Optional[int] = ...) -> None:
        ...

    @overload
    def __init__(
        self, *, type: Literal[AutoModRuleActionType.send_alert_message] = ..., channel_id: Optional[int] = ...
    ) -> None:
        ...

    @overload
    def __init__(self, *, duration: datetime.timedelta = ...) -> None:
        ...

    @overload
    def __init__(
        self, *, type: Literal[AutoModRuleActionType.timeout] = ..., duration: Optional[datetime.timedelta] = ...
    ) -> None:
        ...

    @overload
    def __init__(self, *, custom_message: Optional[str] = ...) -> None:
        ...

    @overload
    def __init__(self, *, type: Literal[AutoModRuleActionType.block_message] = ...) -> None:
        ...


Review comment (suggestion):
Not sure if `channel_id` or `timeout` should ever be `Optional` in the overloads.

You also probably don't want types other than `block_message` having a default i.e. `= ...` in the overloads.

Code after:
    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
    """

    __slots__ = ('type', 'channel_id', 'duration', 'custom_message')

    @overload
    def __init__(self, *, channel_id: int = ...) -> None:
        ...

    @overload
    def __init__(self, *, type: Literal[AutoModRuleActionType.send_alert_message], channel_id: int = ...) -> None:
        ...

    @overload
    def __init__(self, *, duration: datetime.timedelta = ...) -> None:
        ...

    @overload
    def __init__(self, *, type: Literal[AutoModRuleActionType.timeout], duration: datetime.timedelta = ...) -> None:
        ...

    @overload
    def __init__(self, *, custom_message: str = ...) -> None:
        ...

    @overload
    def __init__(self, *, type: Literal[AutoModRuleActionType.block_message]) -> None:
        ...

    @overload
    def __init__(self, *, type: Literal[AutoModRuleActionType.block_message], custom_message: Optional[str] = ...) -> None:
        ...

    @overload
    def __init__(