Browse Source

Add support for automod_quarantined_guild_tag member flag

master
Sacul 20 hours ago
committed by GitHub
parent
commit
e715ad6419
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      discord/audit_logs.py
  2. 4
      discord/enums.py
  3. 9
      discord/flags.py
  4. 1
      discord/types/audit_log.py
  5. 17
      docs/api.rst

13
discord/audit_logs.py

@ -614,6 +614,11 @@ class _AuditLogProxyAutoModAction(_AuditLogProxy):
channel: Optional[Union[abc.GuildChannel, Thread]] channel: Optional[Union[abc.GuildChannel, Thread]]
class _AuditLogProxyAutoModActionQuarantineUser(_AuditLogProxy):
automod_rule_name: str
automod_rule_trigger_type: str
class _AuditLogProxyMemberKickOrMemberRoleUpdate(_AuditLogProxy): class _AuditLogProxyMemberKickOrMemberRoleUpdate(_AuditLogProxy):
integration_type: Optional[str] integration_type: Optional[str]
@ -704,6 +709,7 @@ class AuditLogEntry(Hashable):
_AuditLogProxyStageInstanceAction, _AuditLogProxyStageInstanceAction,
_AuditLogProxyMessageBulkDelete, _AuditLogProxyMessageBulkDelete,
_AuditLogProxyAutoModAction, _AuditLogProxyAutoModAction,
_AuditLogProxyAutoModActionQuarantineUser,
_AuditLogProxyMemberKickOrMemberRoleUpdate, _AuditLogProxyMemberKickOrMemberRoleUpdate,
Member, User, None, PartialIntegration, Member, User, None, PartialIntegration,
Role, Object Role, Object
@ -759,6 +765,13 @@ class AuditLogEntry(Hashable):
), ),
channel=channel, 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_'): elif self.action.name.startswith('overwrite_'):
# the overwrite_ actions have a dict with some information # the overwrite_ actions have a dict with some information

4
discord/enums.py

@ -398,6 +398,7 @@ class AuditLogAction(Enum):
automod_block_message = 143 automod_block_message = 143
automod_flag_message = 144 automod_flag_message = 144
automod_timeout_member = 145 automod_timeout_member = 145
automod_quarantine_user = 146
creator_monetization_request_created = 150 creator_monetization_request_created = 150
creator_monetization_terms_accepted = 151 creator_monetization_terms_accepted = 151
# fmt: on # fmt: on
@ -460,6 +461,7 @@ class AuditLogAction(Enum):
AuditLogAction.automod_block_message: None, AuditLogAction.automod_block_message: None,
AuditLogAction.automod_flag_message: None, AuditLogAction.automod_flag_message: None,
AuditLogAction.automod_timeout_member: None, AuditLogAction.automod_timeout_member: None,
AuditLogAction.automod_quarantine_user: None,
AuditLogAction.creator_monetization_request_created: None, AuditLogAction.creator_monetization_request_created: None,
AuditLogAction.creator_monetization_terms_accepted: None, AuditLogAction.creator_monetization_terms_accepted: None,
AuditLogAction.soundboard_sound_create: AuditLogActionCategory.create, AuditLogAction.soundboard_sound_create: AuditLogActionCategory.create,
@ -506,7 +508,7 @@ class AuditLogAction(Enum):
return 'integration_or_app_command' return 'integration_or_app_command'
elif 139 < v < 143: elif 139 < v < 143:
return 'auto_moderation' return 'auto_moderation'
elif v < 146: elif v < 147:
return 'user' return 'user'
elif v < 152: elif v < 152:
return 'creator_monetization' return 'creator_monetization'

9
discord/flags.py

@ -2094,6 +2094,15 @@ class MemberFlags(BaseFlags):
""" """
return 1 << 7 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 @flag_value
def dm_settings_upsell_acknowledged(self): def dm_settings_upsell_acknowledged(self):
""":class:`bool`: Returns ``True`` if the member has dismissed the DM settings upsell. """:class:`bool`: Returns ``True`` if the member has dismissed the DM settings upsell.

1
discord/types/audit_log.py

@ -97,6 +97,7 @@ AuditLogEvent = Literal[
143, 143,
144, 144,
145, 145,
146,
150, 150,
151, 151,
] ]

17
docs/api.rst

@ -3055,6 +3055,23 @@ of :class:`enum.Enum`.
.. versionadded:: 2.1 .. 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 .. attribute:: creator_monetization_request_created
A request to monetize the server was created. A request to monetize the server was created.

Loading…
Cancel
Save