Skip to content

Commit 59d3f38

Browse files
feat: ✨ Implement and document AuditLogDiff.communication_disabled_until (#2883)
* ✨ Implement and document `AuditLogDiff.communication_disabled_until` * 📝 CHANGELOG.md --------- Signed-off-by: Lala Sabathil <[email protected]> Co-authored-by: Lala Sabathil <[email protected]>
1 parent 54ca771 commit 59d3f38

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ These changes are available on the `master` branch, but have not yet been releas
6969
([#2818](https://github.com/Pycord-Development/pycord/pull/2818))
7070
- Added `Interaction.attachment_size_limit`.
7171
([#2854](https://github.com/Pycord-Development/pycord/pull/2854))
72+
- Added `AuditLogDiff.communication_disabled_until`.
73+
([#2883](https://github.com/Pycord-Development/pycord/pull/2883))
7274

7375
### Fixed
7476

discord/audit_logs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from __future__ import annotations
2727

28+
import datetime
2829
from functools import cached_property
2930
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generator, TypeVar
3031

@@ -45,8 +46,6 @@
4546

4647

4748
if TYPE_CHECKING:
48-
import datetime
49-
5049
from . import abc
5150
from .emoji import GuildEmoji
5251
from .guild import Guild
@@ -210,6 +209,14 @@ def _transform_trigger_metadata(
210209
return AutoModTriggerMetadata.from_dict(data)
211210

212211

212+
def _transform_communication_disabled_until(
213+
entry: AuditLogEntry, data: str
214+
) -> datetime.datetime | None:
215+
if data:
216+
return datetime.datetime.fromisoformat(data)
217+
return None
218+
219+
213220
class AuditLogDiff:
214221
def __len__(self) -> int:
215222
return len(self.__dict__)
@@ -282,6 +289,7 @@ class AuditLogChanges:
282289
"trigger_metadata": (None, _transform_trigger_metadata),
283290
"exempt_roles": (None, _transform_roles),
284291
"exempt_channels": (None, _transform_channels),
292+
"communication_disabled_until": (None, _transform_communication_disabled_until),
285293
}
286294

287295
def __init__(

docs/api/audit_logs.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,17 @@ this goal, it must make use of a couple of data classes that aid in this goal.
524524

525525
:type: :class:`str`
526526

527-
.. attribute:: image
527+
.. attribute:: image
528528

529-
The cover image of a :class:`ScheduledEvent`.
529+
The cover image of a :class:`ScheduledEvent`.
530530

531-
:type: :class:`str`
531+
:type: :class:`str`
532+
533+
.. attribute:: communication_disabled_until
534+
535+
Until when a :class:`Member` will be timed out
536+
537+
:type: :class:`datetime.datetime` | :data:`None`
532538

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

0 commit comments

Comments
 (0)