diff options
| -rw-r--r-- | bot/exts/backend/branding/_repository.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/backend/branding/_repository.py b/bot/exts/backend/branding/_repository.py index d661cd7a8..18720e581 100644 --- a/bot/exts/backend/branding/_repository.py +++ b/bot/exts/backend/branding/_repository.py @@ -1,3 +1,4 @@ +import inspect import typing as t from datetime import UTC, date, datetime @@ -45,10 +46,11 @@ class RemoteObject: def __init__(self, dictionary: dict[str, t.Any]) -> None: """Initialize by grabbing annotated attributes from `dictionary`.""" - missing_keys = self.__annotations__.keys() - dictionary.keys() + annotation_keys = inspect.get_annotations(self.__class__) + missing_keys = annotation_keys - dictionary.keys() if missing_keys: raise KeyError(f"Fetched object lacks expected keys: {missing_keys}") - for annotation in self.__annotations__: + for annotation in annotation_keys: setattr(self, annotation, dictionary[annotation]) |