Skip to content

Commit 54ca771

Browse files
authored
fix: 🐛 Fix AttributeError when accessing AuditLogEntry.changes more than once (#2882)
* 🐛 Fix `AttributeError` when accessing `AuditLogEntry.changes` more than once * 📝 CHANGELOG
1 parent a6b6922 commit 54ca771

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ These changes are available on the `master` branch, but have not yet been releas
140140
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
141141
- Fixed `TypeError` when using `@option` with certain annotations and along with
142142
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
143+
- Fixed `AttributeError` when accessing `AuditLogEntry.changes` more than once.
144+
([#2882])(https://github.com/Pycord-Development/pycord/pull/2882))
143145

144146
### Changed
145147

discord/audit_logs.py

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

2626
from __future__ import annotations
2727

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

3031
from . import enums, utils
@@ -636,7 +637,7 @@ def category(self) -> enums.AuditLogActionCategory:
636637
"""The category of the action, if applicable."""
637638
return self.action.category
638639

639-
@property
640+
@cached_property
640641
def changes(self) -> AuditLogChanges:
641642
"""The list of changes this entry has."""
642643
obj = AuditLogChanges(self, self._changes, state=self._state)

0 commit comments

Comments
 (0)