Skip to content

Commit 6085463

Browse files
Paillat-devLulalaby
andcommitted
feat: ✨ Implement and document AuditLogDiff.communication_disabled_until (Pycord-Development#2883)
* ✨ Implement and document `AuditLogDiff.communication_disabled_until` * 📝 CHANGELOG.md --------- Signed-off-by: Lala Sabathil <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> (cherry picked from commit 59d3f38)
1 parent 9a7f49e commit 6085463

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

@@ -46,8 +47,6 @@
4647

4748

4849
if TYPE_CHECKING:
49-
import datetime
50-
5150
from . import abc
5251
from .emoji import GuildEmoji
5352
from .guild import Guild
@@ -197,6 +196,14 @@ def _transform_trigger_metadata(
197196
return AutoModTriggerMetadata.from_dict(data)
198197

199198

199+
def _transform_communication_disabled_until(
200+
entry: AuditLogEntry, data: str
201+
) -> datetime.datetime | None:
202+
if data:
203+
return datetime.datetime.fromisoformat(data)
204+
return None
205+
206+
200207
class AuditLogDiff:
201208
def __len__(self) -> int:
202209
return len(self.__dict__)
@@ -269,6 +276,7 @@ class AuditLogChanges:
269276
"trigger_metadata": (None, _transform_trigger_metadata),
270277
"exempt_roles": (None, _transform_roles),
271278
"exempt_channels": (None, _transform_channels),
279+
"communication_disabled_until": (None, _transform_communication_disabled_until),
272280
}
273281

274282
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)