mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Fix trigger missing regex_filter and allow_list in audit log
This commit is contained in:
parent
82b12ba481
commit
0cd24b73f7
@ -239,10 +239,6 @@ def _transform_automod_trigger_metadata(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# If cannot get trigger type from the rule and data is empty, then cannot determine trigger type
|
||||
if not data:
|
||||
return None
|
||||
|
||||
# Try to infer trigger type from available keys in data
|
||||
if 'presets' in data:
|
||||
return AutoModTrigger(
|
||||
@ -251,9 +247,16 @@ def _transform_automod_trigger_metadata(
|
||||
allow_list=data.get('allow_list'),
|
||||
)
|
||||
elif 'keyword_filter' in data:
|
||||
return AutoModTrigger(type=enums.AutoModRuleTriggerType.keyword, keyword_filter=data['keyword_filter']) # type: ignore
|
||||
return AutoModTrigger(
|
||||
type=enums.AutoModRuleTriggerType.keyword,
|
||||
keyword_filter=data['keyword_filter'], # type: ignore
|
||||
allow_list=data.get('allow_list'),
|
||||
regex_patterns=data.get('regex_patterns'),
|
||||
)
|
||||
elif 'mention_total_limit' in data:
|
||||
return AutoModTrigger(type=enums.AutoModRuleTriggerType.mention_spam, mention_limit=data['mention_total_limit']) # type: ignore
|
||||
else:
|
||||
return AutoModTrigger(type=enums.AutoModRuleTriggerType.spam)
|
||||
|
||||
|
||||
def _transform_automod_actions(entry: AuditLogEntry, data: List[AutoModerationAction]) -> List[AutoModRuleAction]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user