Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2818](https://github.com/Pycord-Development/pycord/pull/2818))
- Added `Interaction.attachment_size_limit`.
([#2854](https://github.com/Pycord-Development/pycord/pull/2854))
- Added `AuditLogDiff.communication_disabled_until`.
([#2883](https://github.com/Pycord-Development/pycord/pull/2883))

### Fixed

Expand Down
12 changes: 10 additions & 2 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from __future__ import annotations

import datetime
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generator, TypeVar

from . import enums, utils
Expand All @@ -44,8 +45,6 @@


if TYPE_CHECKING:
import datetime

from . import abc
from .emoji import GuildEmoji
from .guild import Guild
Expand Down Expand Up @@ -209,6 +208,14 @@ def _transform_trigger_metadata(
return AutoModTriggerMetadata.from_dict(data)


def _transform_communication_disabled_until(
entry: AuditLogEntry, data: str
) -> datetime.datetime | None:
if data:
return datetime.datetime.fromisoformat(data)
return None


class AuditLogDiff:
def __len__(self) -> int:
return len(self.__dict__)
Expand Down Expand Up @@ -281,6 +288,7 @@ class AuditLogChanges:
"trigger_metadata": (None, _transform_trigger_metadata),
"exempt_roles": (None, _transform_roles),
"exempt_channels": (None, _transform_channels),
"communication_disabled_until": (None, _transform_communication_disabled_until),
}

def __init__(
Expand Down
12 changes: 9 additions & 3 deletions docs/api/audit_logs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,17 @@ this goal, it must make use of a couple of data classes that aid in this goal.

:type: :class:`str`

.. attribute:: image
.. attribute:: image

The cover image of a :class:`ScheduledEvent`.
The cover image of a :class:`ScheduledEvent`.

:type: :class:`str`
:type: :class:`str`

.. attribute:: communication_disabled_until

Until when a :class:`Member` will be timed out

:type: :class:`datetime.datetime` | :data:`None`

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