Browse Source

Add cover_image to AuditLogDiff

pull/7765/head
z03h 3 years ago
committed by GitHub
parent
commit
8993b7f5fe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      discord/audit_logs.py
  2. 21
      docs/api.rst

8
discord/audit_logs.py

@ -141,6 +141,12 @@ def _transform_avatar(entry: AuditLogEntry, data: Optional[str]) -> Optional[Ass
return Asset._from_avatar(entry._state, entry._target_id, data) # type: ignore - target_id won't be None in this case
def _transform_cover_image(entry: AuditLogEntry, data: Optional[str]) -> Optional[Asset]:
if data is None:
return None
return Asset._from_scheduled_event_cover_image(entry._state, entry._target_id, data) # type: ignore - target_id won't be None in this case
def _guild_hash_transformer(path: str) -> Callable[[AuditLogEntry, Optional[str]], Optional[Asset]]:
def _transform(entry: AuditLogEntry, data: Optional[str]) -> Optional[Asset]:
if data is None:
@ -238,6 +244,8 @@ class AuditLogChanges:
'mfa_level': (None, _enum_transformer(enums.MFALevel)),
'status': (None, _enum_transformer(enums.EventStatus)),
'entity_type': (None, _enum_transformer(enums.EntityType)),
'preferred_locale': (None, _enum_transformer(enums.Locale)),
'image_hash': ('cover_image', _transform_cover_image),
}
# fmt: on

21
docs/api.rst

@ -1690,7 +1690,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.afk_channel`
- :attr:`~AuditLogDiff.system_channel`
- :attr:`~AuditLogDiff.afk_timeout`
- :attr:`~AuditLogDiff.default_message_notifications`
- :attr:`~AuditLogDiff.default_notifications`
- :attr:`~AuditLogDiff.explicit_content_filter`
- :attr:`~AuditLogDiff.mfa_level`
- :attr:`~AuditLogDiff.name`
@ -2286,6 +2286,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.privacy_level`
- :attr:`~AuditLogDiff.status`
- :attr:`~AuditLogDiff.entity_type`
- :attr:`~AuditLogDiff.cover_image`
.. versionadded:: 2.0
@ -2304,6 +2305,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.privacy_level`
- :attr:`~AuditLogDiff.status`
- :attr:`~AuditLogDiff.entity_type`
- :attr:`~AuditLogDiff.cover_image`
.. versionadded:: 2.0
@ -2322,6 +2324,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.privacy_level`
- :attr:`~AuditLogDiff.status`
- :attr:`~AuditLogDiff.entity_type`
- :attr:`~AuditLogDiff.cover_image`
.. versionadded:: 2.0
@ -3024,12 +3027,6 @@ AuditLogDiff
:type: :class:`ContentFilter`
.. attribute:: default_message_notifications
The guild's default message notification setting.
:type: :class:`int`
.. attribute:: vanity_url_code
The guild's vanity URL.
@ -3365,7 +3362,7 @@ AuditLogDiff
See also :attr:`Guild.preferred_locale`
:type: :class:`str`
:type: :class:`Locale`
.. attribute:: prune_delete_days
@ -3385,6 +3382,14 @@ AuditLogDiff
:type: :class:`EntityType`
.. attribute:: cover_image
The scheduled event's cover image.
See also :attr:`ScheduledEvent.cover_image`.
:type: :class:`Asset`
.. this is currently missing the following keys: reason and application_id
I'm not sure how to about porting these

Loading…
Cancel
Save