mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 18:11:59 +00:00
Add support for integration_type in audit logs
Currently unsure whether more processing is meant to be done with this, but for now an Optional[str] is the best I can do without more data.
This commit is contained in:
parent
a756df3d5c
commit
60ff239558
@ -528,6 +528,10 @@ class _AuditLogProxyAutoModAction(_AuditLogProxy):
|
|||||||
channel: Optional[Union[abc.GuildChannel, Thread]]
|
channel: Optional[Union[abc.GuildChannel, Thread]]
|
||||||
|
|
||||||
|
|
||||||
|
class _AuditLogProxyMemberKickOrMemberRoleUpdate(_AuditLogProxy):
|
||||||
|
integration_type: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
class AuditLogEntry(Hashable):
|
class AuditLogEntry(Hashable):
|
||||||
r"""Represents an Audit Log entry.
|
r"""Represents an Audit Log entry.
|
||||||
|
|
||||||
@ -614,6 +618,7 @@ class AuditLogEntry(Hashable):
|
|||||||
_AuditLogProxyStageInstanceAction,
|
_AuditLogProxyStageInstanceAction,
|
||||||
_AuditLogProxyMessageBulkDelete,
|
_AuditLogProxyMessageBulkDelete,
|
||||||
_AuditLogProxyAutoModAction,
|
_AuditLogProxyAutoModAction,
|
||||||
|
_AuditLogProxyMemberKickOrMemberRoleUpdate,
|
||||||
Member, User, None, PartialIntegration,
|
Member, User, None, PartialIntegration,
|
||||||
Role, Object
|
Role, Object
|
||||||
] = None
|
] = None
|
||||||
@ -638,6 +643,10 @@ class AuditLogEntry(Hashable):
|
|||||||
elif self.action is enums.AuditLogAction.message_bulk_delete:
|
elif self.action is enums.AuditLogAction.message_bulk_delete:
|
||||||
# The bulk message delete action has the number of messages deleted
|
# The bulk message delete action has the number of messages deleted
|
||||||
self.extra = _AuditLogProxyMessageBulkDelete(count=int(extra['count']))
|
self.extra = _AuditLogProxyMessageBulkDelete(count=int(extra['count']))
|
||||||
|
elif self.action in (enums.AuditLogAction.kick, enums.AuditLogAction.member_role_update):
|
||||||
|
# The member kick action has a dict with some information
|
||||||
|
integration_type = extra.get('integration_type')
|
||||||
|
self.extra = _AuditLogProxyMemberKickOrMemberRoleUpdate(integration_type=integration_type)
|
||||||
elif self.action.name.endswith('pin'):
|
elif self.action.name.endswith('pin'):
|
||||||
# the pin actions have a dict with some information
|
# the pin actions have a dict with some information
|
||||||
channel_id = int(extra['channel_id'])
|
channel_id = int(extra['channel_id'])
|
||||||
|
@ -316,6 +316,7 @@ class AuditEntryInfo(TypedDict):
|
|||||||
guild_id: Snowflake
|
guild_id: Snowflake
|
||||||
auto_moderation_rule_name: str
|
auto_moderation_rule_name: str
|
||||||
auto_moderation_rule_trigger_type: str
|
auto_moderation_rule_trigger_type: str
|
||||||
|
integration_type: str
|
||||||
|
|
||||||
|
|
||||||
class AuditLogEntry(TypedDict):
|
class AuditLogEntry(TypedDict):
|
||||||
|
10
docs/api.rst
10
docs/api.rst
@ -2106,6 +2106,11 @@ of :class:`enum.Enum`.
|
|||||||
When this is the action, the type of :attr:`~AuditLogEntry.target` is
|
When this is the action, the type of :attr:`~AuditLogEntry.target` is
|
||||||
the :class:`User` or :class:`Object` who got kicked.
|
the :class:`User` or :class:`Object` who got kicked.
|
||||||
|
|
||||||
|
When this is the action, the type of :attr:`~AuditLogEntry.extra` is
|
||||||
|
set to an unspecified proxy object with one attribute:
|
||||||
|
|
||||||
|
- ``integration_type``: An optional string that denotes the type of integration that did the action.
|
||||||
|
|
||||||
When this is the action, :attr:`~AuditLogEntry.changes` is empty.
|
When this is the action, :attr:`~AuditLogEntry.changes` is empty.
|
||||||
|
|
||||||
.. attribute:: member_prune
|
.. attribute:: member_prune
|
||||||
@ -2166,6 +2171,11 @@ of :class:`enum.Enum`.
|
|||||||
When this is the action, the type of :attr:`~AuditLogEntry.target` is
|
When this is the action, the type of :attr:`~AuditLogEntry.target` is
|
||||||
the :class:`Member`, :class:`User`, or :class:`Object` who got the role.
|
the :class:`Member`, :class:`User`, or :class:`Object` who got the role.
|
||||||
|
|
||||||
|
When this is the action, the type of :attr:`~AuditLogEntry.extra` is
|
||||||
|
set to an unspecified proxy object with one attribute:
|
||||||
|
|
||||||
|
- ``integration_type``: An optional string that denotes the type of integration that did the action.
|
||||||
|
|
||||||
Possible attributes for :class:`AuditLogDiff`:
|
Possible attributes for :class:`AuditLogDiff`:
|
||||||
|
|
||||||
- :attr:`~AuditLogDiff.roles`
|
- :attr:`~AuditLogDiff.roles`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user