Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(AuditLog): guild scheduled event image #432

Merged
9 changes: 9 additions & 0 deletions disnake/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ def _transform_privacy_level(
return enums.try_enum(enums.StagePrivacyLevel, data)


def _transform_guild_scheduled_event_image(
entry: AuditLogEntry, data: Optional[str]
) -> Optional[Asset]:
if data is None:
return None
return Asset._from_guild_scheduled_event_image(entry._state, entry._target_id, data) # type: ignore


class AuditLogDiff:
def __len__(self) -> int:
return len(self.__dict__)
Expand Down Expand Up @@ -241,6 +249,7 @@ class AuditLogChanges:
'tags': ('emoji', None),
'default_message_notifications': ('default_notifications', _enum_transformer(enums.NotificationLevel)),
'communication_disabled_until': ('timeout', _transform_datetime),
'image_hash': ('image', _transform_guild_scheduled_event_image),
'region': (None, _enum_transformer(enums.VoiceRegion)),
'rtc_region': (None, _enum_transformer(enums.VoiceRegion)),
'video_quality_mode': (None, _enum_transformer(enums.VideoQualityMode)),
Expand Down
7 changes: 7 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,7 @@ of :class:`enum.Enum`.
- :attr:`~AuditLogDiff.description`
- :attr:`~AuditLogDiff.privacy_level`
- :attr:`~AuditLogDiff.status`
- :attr:`~AuditLogDiff.image`

.. versionadded:: 2.3

Expand Down Expand Up @@ -3748,6 +3749,12 @@ AuditLogDiff

:type: :class:`GuildScheduledEventStatus`

.. attribute:: image

The cover image of a guild scheduled event being changed.

:type: :class:`Asset`

.. this is currently missing the following keys: reason and application_id
I'm not sure how to about porting these

Expand Down