An implementation of an e621 watch bot as an excuse to learn BEAM programming
Find a file
2025-11-01 19:58:57 -06:00
src (feat): Notification root actor created & tested 2025-11-01 19:58:57 -06:00
test (feat): Notification root actor created & tested 2025-11-01 19:58:57 -06:00
.gitignore init 2025-11-01 12:48:03 -06:00
gleam.toml (feat): tag_group & user actors created 2025-11-01 18:42:42 -06:00
manifest.toml (feat): tag_group & user actors created 2025-11-01 18:42:42 -06:00
README.md (feat): tag_group & user actors created 2025-11-01 18:42:42 -06:00

stag_net

This is a project to listen to an image repository for new posts. A post is a file that consists of a list of tags applied to it. This application allows users to register tag_groups which are either a Watch group or a Block group. Images which match a user's Watch group and do not match a Block group are sent to the user.

Notification Architecture

Note: this is not the most efficient way to do this. I just want to play with the OTP model

  • A root level notification engine
  • A user notification engine per user
  • A tag_group notification engine per user's tag groups

root notification has many children, user notification has many children, tag_group has no children

Post received from image API -> root notification engine -> user 1 -> tag_group 1
                                                                   -> tag_group 2
                                                         -> user 2 -> tag_group 3
                                                                   -> tag_group 4

tag_group Noticification Engine

State:

  • a set of tags that are the members of a given tag_group

Subjects:

  • (in) receives a set of tags which represent a post
  • (out) emits a boolean of whether or not a post's tags are a superset of the tag_group

user Notification Engine

State:

  • The associated user
  • Subject registry for all child tag_group notification
  • Subject to emit telegram notifications via if post matches rules

Subjects:

  • (in) receives a Post from the image repository API
  • (in) receives booleans from tag_group notifications
  • (out) emits a PostNotification object to the telegram notifaction actor

root Notification Engine

The root notification engine manages a dynamic set of actors. New user actors are created when new users register with the application. user actors are removed when the user deactivates the application

State:

  • A map of user.id -> user notification subject

Subjects:

  • (in) receives a Post from the image repository API
  • (in) receives application events to start or stop user agents

Development

gleam run   # Run the project
gleam test  # Run the tests