mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 08:56:19 +00:00
Fix member_profile triggers not having attributes filled
This commit is contained in:
@ -213,8 +213,8 @@ class AutoModTrigger:
|
||||
type: :class:`AutoModRuleTriggerType`
|
||||
The type of trigger.
|
||||
keyword_filter: List[:class:`str`]
|
||||
The list of strings that will trigger the keyword filter. Maximum of 1000.
|
||||
Keywords can only be up to 60 characters in length.
|
||||
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`]
|
||||
@ -260,8 +260,11 @@ class AutoModTrigger:
|
||||
regex_patterns: Optional[List[str]] = None,
|
||||
mention_raid_protection: Optional[bool] = None,
|
||||
) -> None:
|
||||
if type is None and sum(arg is not None for arg in (keyword_filter or regex_patterns, presets, mention_limit)) > 1:
|
||||
raise ValueError('Please pass only one of keyword_filter, regex_patterns, presets, or mention_limit.')
|
||||
unique_args = (keyword_filter or regex_patterns, presets, mention_limit or mention_raid_protection)
|
||||
if type is None and sum(arg is not None for arg in unique_args) > 1:
|
||||
raise ValueError(
|
||||
'Please pass only one of keyword_filter/regex_patterns, presets, or mention_limit/mention_raid_protection.'
|
||||
)
|
||||
|
||||
if type is not None:
|
||||
self.type = type
|
||||
@ -273,7 +276,7 @@ class AutoModTrigger:
|
||||
self.type = AutoModRuleTriggerType.mention_spam
|
||||
else:
|
||||
raise ValueError(
|
||||
'Please pass the trigger type explicitly if not using keyword_filter, presets, or mention_limit.'
|
||||
'Please pass the trigger type explicitly if not using keyword_filter, regex_patterns, presets, mention_limit, or mention_raid_protection.'
|
||||
)
|
||||
|
||||
self.keyword_filter: List[str] = keyword_filter if keyword_filter is not None else []
|
||||
@ -296,7 +299,7 @@ class AutoModTrigger:
|
||||
type_ = try_enum(AutoModRuleTriggerType, type)
|
||||
if data is None:
|
||||
return cls(type=type_)
|
||||
elif type_ is AutoModRuleTriggerType.keyword:
|
||||
elif type_ in (AutoModRuleTriggerType.keyword, AutoModRuleTriggerType.member_profile):
|
||||
return cls(
|
||||
type=type_,
|
||||
keyword_filter=data.get('keyword_filter'),
|
||||
@ -317,7 +320,7 @@ class AutoModTrigger:
|
||||
return cls(type=type_)
|
||||
|
||||
def to_metadata_dict(self) -> Optional[Dict[str, Any]]:
|
||||
if self.type is AutoModRuleTriggerType.keyword:
|
||||
if self.type in (AutoModRuleTriggerType.keyword, AutoModRuleTriggerType.member_profile):
|
||||
return {
|
||||
'keyword_filter': self.keyword_filter,
|
||||
'regex_patterns': self.regex_patterns,
|
||||
@ -355,6 +358,8 @@ class AutoModRule:
|
||||
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.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
|
Reference in New Issue
Block a user