mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Add missing audit log properties
This commit is contained in:
parent
de85eacbf5
commit
352dcf9557
@ -62,6 +62,10 @@ if TYPE_CHECKING:
|
||||
from .threads import Thread
|
||||
|
||||
|
||||
def _transform_timestamp(entry: AuditLogEntry, data: Optional[str]) -> Optional[datetime.datetime]:
|
||||
return utils.parse_time(data)
|
||||
|
||||
|
||||
def _transform_permissions(entry: AuditLogEntry, data: str) -> Permissions:
|
||||
return Permissions(int(data))
|
||||
|
||||
@ -85,10 +89,11 @@ def _transform_member_id(entry: AuditLogEntry, data: Optional[Snowflake]) -> Uni
|
||||
return None
|
||||
return entry._get_member(int(data))
|
||||
|
||||
|
||||
def _transform_guild_id(entry: AuditLogEntry, data: Optional[Snowflake]) -> Optional[Guild]:
|
||||
if data is None:
|
||||
return None
|
||||
return entry._state._get_guild(data)
|
||||
return entry._state._get_guild(int(data))
|
||||
|
||||
|
||||
def _transform_overwrites(
|
||||
@ -149,7 +154,7 @@ def _enum_transformer(enum: Type[T]) -> Callable[[AuditLogEntry, int], T]:
|
||||
|
||||
return _transform
|
||||
|
||||
def _transform_type(entry: AuditLogEntry, data: Union[int]) -> Union[enums.ChannelType, enums.StickerType]:
|
||||
def _transform_type(entry: AuditLogEntry, data: int) -> Union[enums.ChannelType, enums.StickerType]:
|
||||
if entry.action.name.startswith('sticker_'):
|
||||
return enums.try_enum(enums.StickerType, data)
|
||||
else:
|
||||
@ -212,6 +217,8 @@ class AuditLogChanges:
|
||||
'privacy_level': (None, _enum_transformer(enums.StagePrivacyLevel)),
|
||||
'format_type': (None, _enum_transformer(enums.StickerFormatType)),
|
||||
'type': (None, _transform_type),
|
||||
'communication_disabled_until': ('timed_out_until', _transform_timestamp),
|
||||
'expire_behavior': (None, _enum_transformer(enums.ExpireBehaviour)),
|
||||
}
|
||||
# fmt: on
|
||||
|
||||
|
41
docs/api.rst
41
docs/api.rst
@ -1940,6 +1940,7 @@ of :class:`enum.Enum`.
|
||||
- :attr:`~AuditLogDiff.nick`
|
||||
- :attr:`~AuditLogDiff.mute`
|
||||
- :attr:`~AuditLogDiff.deaf`
|
||||
- :attr:`~AuditLogDiff.timed_out_until`
|
||||
|
||||
.. attribute:: member_role_update
|
||||
|
||||
@ -2350,6 +2351,7 @@ of :class:`enum.Enum`.
|
||||
- :attr:`~AuditLogDiff.archived`
|
||||
- :attr:`~AuditLogDiff.locked`
|
||||
- :attr:`~AuditLogDiff.auto_archive_duration`
|
||||
- :attr:`~AuditLogDiff.invitable`
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
@ -2367,6 +2369,7 @@ of :class:`enum.Enum`.
|
||||
- :attr:`~AuditLogDiff.archived`
|
||||
- :attr:`~AuditLogDiff.locked`
|
||||
- :attr:`~AuditLogDiff.auto_archive_duration`
|
||||
- :attr:`~AuditLogDiff.invitable`
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
@ -2384,6 +2387,7 @@ of :class:`enum.Enum`.
|
||||
- :attr:`~AuditLogDiff.archived`
|
||||
- :attr:`~AuditLogDiff.locked`
|
||||
- :attr:`~AuditLogDiff.auto_archive_duration`
|
||||
- :attr:`~AuditLogDiff.invitable`
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
@ -3266,6 +3270,43 @@ AuditLogDiff
|
||||
|
||||
:type: :class:`int`
|
||||
|
||||
.. attribute:: invitable
|
||||
|
||||
Whetheer non-moderators can add users to this private thread.
|
||||
|
||||
:type: :class:`bool`
|
||||
|
||||
.. attribute:: timed_out_until
|
||||
|
||||
Whether the user is timed out, and if so until when.
|
||||
|
||||
:type: Optional[:class:`datetime.datetime`]
|
||||
|
||||
.. attribute:: enable_emoticons
|
||||
|
||||
Integration emoticons were enabled or disabled.
|
||||
|
||||
see also :attr:`Integration.enable_emoticons`
|
||||
|
||||
:type: :class:`bool`
|
||||
|
||||
.. attribute:: expire_behaviour
|
||||
expire_behavior
|
||||
|
||||
The behaviour of expiring subscribers changed.
|
||||
|
||||
see also :attr:`Integration.expire_grace_period`
|
||||
|
||||
:type: :class:`ExpireBehaviour`
|
||||
|
||||
.. attribute:: expire_grace_period
|
||||
|
||||
The grace period before expiring subscribers changed.
|
||||
|
||||
see also :attr:`Integration.expire_grace_period`
|
||||
|
||||
:type: :class:`int`
|
||||
|
||||
.. this is currently missing the following keys: reason and application_id
|
||||
I'm not sure how to about porting these
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user