Rework Discord event consumer #22

Merged
leming merged 1 commit from arkjedrz_rework-discord-consumer into main 2026-07-11 16:09:14 +00:00
Owner
  • Make base class for consumers.
  • Slight improvement of Discord client.
  • Move Event to separate module.
  • Better logging.
- Make base class for consumers. - Slight improvement of Discord client. - Move `Event` to separate module. - Better logging.
leming self-assigned this 2026-07-01 21:24:44 +00:00
@ -0,0 +18,4 @@
__all__ = ["DiscordEventConsumer"]
def _event_time(time_iso_format: str) -> datetime:
Collaborator

Shouldn't this be part of event? Hardly seems Discord-related

Shouldn't this be part of `event`? Hardly seems Discord-related
Author
Owner

Agree, will probably do along with next consumer change.
#23

Agree, will probably do along with next consumer change. https://forge.hs3.pl/leming/kronos/issues/23
@ -0,0 +60,4 @@
with open(event_mapping_path, "rb") as file:
event_mapping = pickle.load(file)
except Exception:
# TODO: shouldn't this stop the execution?
Collaborator

First run never has a pickle jar so stopping it wouldn't be a good idea

First run never has a pickle jar so stopping it wouldn't be a good idea
leming marked this conversation as resolved
@ -0,0 +74,4 @@
# Set description.
description = f"{event.url}\n\n{event.text_description}"
# Download image.
Collaborator

I think this could also be the provider's job, not the consumer's

I think this could also be the provider's job, not the consumer's
Author
Owner

Agree, to be done separately.
#25

Agree, to be done separately. https://forge.hs3.pl/leming/kronos/issues/25
@ -0,0 +17,4 @@
"""
@abstractmethod
def consume(self, events: list[Event]) -> None:
Collaborator

nomnomnom

nomnomnom
Author
Owner

obraz

![obraz](/attachments/b1f8327f-882b-4bad-b168-edd23794e271)
205 KiB
leming marked this conversation as resolved
@ -151,3 +154,3 @@
try:
# Load `DISCORD_TOKEN` from environment variable.
# # Load `DISCORD_TOKEN` from environment variable.
Collaborator

eh?

eh?
leming marked this conversation as resolved
doomhammer approved these changes 2026-07-07 06:58:58 +00:00
leming force-pushed arkjedrz_rework-discord-consumer from 5a1ce519ba to 7a0b7beb22 2026-07-11 16:08:47 +00:00 Compare
leming changed title from WIP: Rework Discord event consumer to Rework Discord event consumer 2026-07-11 16:08:59 +00:00
leming merged commit d82f9e61d2 into main 2026-07-11 16:09:14 +00:00
leming referenced this pull request from a commit 2026-07-11 16:09:15 +00:00
leming deleted branch arkjedrz_rework-discord-consumer 2026-07-11 16:09:15 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
leming/kronos!22
No description provided.