diff options
| author | 2021-03-09 23:23:44 +0100 | |
|---|---|---|
| committer | 2021-03-13 12:39:42 +0100 | |
| commit | d831086f0f5b21138283e6165f3efe0c42ba2530 (patch) | |
| tree | 079b9f5e6890fef441252e6f983cf7d2bbd5623a | |
| parent | Branding: add event getters (diff) | |
Branding: make event instances aware of their location
This allows us to add a neat string representation.
| -rw-r--r-- | bot/exts/backend/branding/_repository.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bot/exts/backend/branding/_repository.py b/bot/exts/backend/branding/_repository.py index 20e287504..e9d44417f 100644 --- a/bot/exts/backend/branding/_repository.py +++ b/bot/exts/backend/branding/_repository.py @@ -58,9 +58,13 @@ class MetaFile(t.NamedTuple): class Event(t.NamedTuple): """Represent an event defined in the branding repository.""" + path: str # Path from repo root where event lives + meta: MetaFile banner: RemoteObject icons: t.List[RemoteObject] - meta: MetaFile + + def __str__(self) -> str: + return f"<Event at '{self.path}'>" class BrandingRepository: @@ -158,7 +162,7 @@ class BrandingRepository: meta_file = await self.parse_meta_file(meta_bytes) - return Event(contents["banner.png"], list(server_icons.values()), meta_file) + return Event(directory.path, meta_file, contents["banner.png"], list(server_icons.values())) async def get_events(self) -> t.List[Event]: """ |