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

Code before:
        ...

    @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:
        ...

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

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

    def __init__(
        self,
        *,
        type: Optional[AutoModRuleActionType] = None,
        channel_id: Optional[int] = None,
        duration: Optional[datetime.timedelta] = None,
        custom_message: Optional[str] = None,
    ) -> None:
        self.channel_id: Optional[int] = channel_id
        self.duration: Optional[datetime.timedelta] = duration
        self.custom_message: Optional[str] = custom_message

        if sum(v is None for v in (channel_id, duration, custom_message)) < 2:
            raise ValueError('Only one of channel_id, duration, or custom_message can be passed.')

        if type is not None:
            self.type = type
        elif channel_id is not None:
            self.type = AutoModRuleActionType.send_alert_message
        elif duration is not None:
            self.type = AutoModRuleActionType.timeout
        elif custom_message is not None:
            self.type = AutoModRuleActionType.block_message
        else:
            raise ValueError('Please pass the action type explicitly if not using channel_id, custom_message, or duration.')

Review comment (suggestion):
You could re-work the `__init__` to handle this like so. (can't make a suggestion because GH's bad)

```py
    def __init__(
        self,
        *,
        type: Optional[AutoModRuleActionType] = None,
        channel_id: Optional[int] = None,
        duration: Optional[datetime.timedelta] = None,
        custom_message: Optional[str] = None,
    ) -> None:
        self.channel_id: Optional[int] = channel_id
        self.duration: Optional[datetime.timedelta] = duration
        self.custom_message: Optional[str] = custom_message

        # this check is superfluous and only for UX reasons
        if type is None and sum(v is None for v in (channel_id, duration, custom_message)) < 2:
            raise ValueError('Only one of channel_id, duration, or custom_message can be passed.')

        for action_type, attribute, required in (
            (AutoModRuleActionType.send_alert_message, 'channel_id', True),
            (AutoModRuleActionType.timeout, 'duration', True),
            (AutoModRuleActionType.block_message, 'custom_message', False),
        ):
            if getattr(self, attribute) is not None:
                if type is None:
                    type = action_type
                elif type != action_type:
                    raise ValueError(f'{attribute} can only be passed if type is {action_type.name}.')
            elif required and type == action_type:
                raise ValueError(f'{attribute} is required if type is {action_type.name}.')

        self.type: AutoModRuleActionType = type or AutoModRuleActionType.block_message
```

Code after:
        ...

    @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__(
        self,
        *,
        type: Optional[AutoModRuleActionType] = ...,
        channel_id: Optional[int] = ...,
        duration: Optional[datetime.timedelta] = ...,
        custom_message: Optional[str] = ...,
    ) -> None:
        ...

    def __init__(
        self,
        *,
        type: Optional[AutoModRuleActionType] = None,
        channel_id: Optional[int] = None,
        duration: Optional[datetime.timedelta] = None,
        custom_message: Optional[str] = None,
    ) -> None:
        if sum(v is None for v in (channel_id, duration, custom_message)) < 2:
            raise ValueError('Only one of channel_id, duration, or custom_message can be passed.')

        self.type: AutoModRuleActionType
        if type is not None:
            self.type = type
        elif channel_id is not None:
            self.type = AutoModRuleActionType.send_alert_message
        elif duration is not None:
            self.type = AutoModRuleActionType.timeout
        else:
            self.type = AutoModRuleActionType.block_message

        if self.type is AutoModRuleActionType.send_alert_message:
            if channel_id is None:
                raise ValueError('channel_id cannot be None if type is send_alert_message')
            self.channel_id: Optional[int] = channel_id