Skip to content

Commit 5b3b25e

Browse files
authored
Merge branch 'master' into users/tags
Signed-off-by: Lala Sabathil <[email protected]>
2 parents c0806ec + 59d3f38 commit 5b3b25e

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

CHANGELOG.md

Lines changed: 4 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
- Added `discord.User.primary_guild` and the `PrimaryGuild` class.
7375
([#2876](https://github.com/Pycord-Development/pycord/pull/2876))
7476

@@ -142,6 +144,8 @@ These changes are available on the `master` branch, but have not yet been releas
142144
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
143145
- Fixed `TypeError` when using `@option` with certain annotations and along with
144146
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
147+
- Fixed `AttributeError` when accessing `AuditLogEntry.changes` more than once.
148+
([#2882])(https://github.com/Pycord-Development/pycord/pull/2882))
145149

146150
### Changed
147151

discord/audit_logs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
from __future__ import annotations
2727

28+
import datetime
29+
from functools import cached_property
2830
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Generator, TypeVar
2931

3032
from . import enums, utils
@@ -44,8 +46,6 @@
4446

4547

4648
if TYPE_CHECKING:
47-
import datetime
48-
4949
from . import abc
5050
from .emoji import GuildEmoji
5151
from .guild import Guild
@@ -209,6 +209,14 @@ def _transform_trigger_metadata(
209209
return AutoModTriggerMetadata.from_dict(data)
210210

211211

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+
212220
class AuditLogDiff:
213221
def __len__(self) -> int:
214222
return len(self.__dict__)
@@ -281,6 +289,7 @@ class AuditLogChanges:
281289
"trigger_metadata": (None, _transform_trigger_metadata),
282290
"exempt_roles": (None, _transform_roles),
283291
"exempt_channels": (None, _transform_channels),
292+
"communication_disabled_until": (None, _transform_communication_disabled_until),
284293
}
285294

286295
def __init__(
@@ -636,7 +645,7 @@ def category(self) -> enums.AuditLogActionCategory:
636645
"""The category of the action, if applicable."""
637646
return self.action.category
638647

639-
@property
648+
@cached_property
640649
def changes(self) -> AuditLogChanges:
641650
"""The list of changes this entry has."""
642651
obj = AuditLogChanges(self, self._changes, state=self._state)

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)