Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ class _AuditLogProxyAutoModAction(_AuditLogProxy):
channel: Optional[Union[abc.GuildChannel, Thread]]


class _AuditLogProxyAutoModActionQuarantineUser(_AuditLogProxy):
automod_rule_name: str
automod_rule_trigger_type: str


class _AuditLogProxyMemberKickOrMemberRoleUpdate(_AuditLogProxy):
integration_type: Optional[str]

Expand Down Expand Up @@ -704,6 +709,7 @@ def _from_data(self, data: AuditLogEntryPayload) -> None:
_AuditLogProxyStageInstanceAction,
_AuditLogProxyMessageBulkDelete,
_AuditLogProxyAutoModAction,
_AuditLogProxyAutoModActionQuarantineUser,
_AuditLogProxyMemberKickOrMemberRoleUpdate,
Member, User, None, PartialIntegration,
Role, Object
Expand Down Expand Up @@ -759,6 +765,13 @@ def _from_data(self, data: AuditLogEntryPayload) -> None:
),
channel=channel,
)
elif self.action is enums.AuditLogAction.automod_quarantine_user:
self.extra = _AuditLogProxyAutoModActionQuarantineUser(
automod_rule_name=extra['auto_moderation_rule_name'],
automod_rule_trigger_type=enums.try_enum(
enums.AutoModRuleTriggerType, extra['auto_moderation_rule_trigger_type']
),
)

elif self.action.name.startswith('overwrite_'):
# the overwrite_ actions have a dict with some information
Expand Down
4 changes: 3 additions & 1 deletion discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ class AuditLogAction(Enum):
automod_block_message = 143
automod_flag_message = 144
automod_timeout_member = 145
automod_quarantine_user = 146
creator_monetization_request_created = 150
creator_monetization_terms_accepted = 151
# fmt: on
Expand Down Expand Up @@ -460,6 +461,7 @@ def category(self) -> Optional[AuditLogActionCategory]:
AuditLogAction.automod_block_message: None,
AuditLogAction.automod_flag_message: None,
AuditLogAction.automod_timeout_member: None,
AuditLogAction.automod_quarantine_user: None,
AuditLogAction.creator_monetization_request_created: None,
AuditLogAction.creator_monetization_terms_accepted: None,
AuditLogAction.soundboard_sound_create: AuditLogActionCategory.create,
Expand Down Expand Up @@ -506,7 +508,7 @@ def target_type(self) -> Optional[str]:
return 'integration_or_app_command'
elif 139 < v < 143:
return 'auto_moderation'
elif v < 146:
elif v < 147:
return 'user'
elif v < 152:
return 'creator_monetization'
Expand Down
9 changes: 9 additions & 0 deletions discord/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,15 @@ def automod_quarantined_username(self):
"""
return 1 << 7

@flag_value
def automod_quarantined_guild_tag(self):
""":class:`bool`: Returns ``True`` if the member's guild tag has been
blocked by AutoMod.

.. versionadded:: 2.6
"""
return 1 << 10

@flag_value
def dm_settings_upsell_acknowledged(self):
""":class:`bool`: Returns ``True`` if the member has dismissed the DM settings upsell.
Expand Down
1 change: 1 addition & 0 deletions discord/types/audit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
143,
144,
145,
146,
150,
151,
]
Expand Down
17 changes: 17 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3055,6 +3055,23 @@ of :class:`enum.Enum`.

.. versionadded:: 2.1

.. attribute:: automod_quarantine_user

An automod rule quarantined a member.

When this is the action, the type of :attr:`~AuditLogEntry.target` is
a :class:`Member` with the ID of the person who triggered the automod rule.

When this is the action, the type of :attr:`~AuditLogEntry.extra` is
set to an unspecified proxy object with 2 attributes:

- ``automod_rule_name``: The name of the automod rule that was triggered.
- ``automod_rule_trigger_type``: A :class:`AutoModRuleTriggerType` representation of the rule type that was triggered.

When this is the action, :attr:`AuditLogEntry.changes` is empty.

.. versionadded:: 2.6

.. attribute:: creator_monetization_request_created

A request to monetize the server was created.
Expand Down
Loading