this post was submitted on 08 Jan 2024
56 points (96.7% liked)

Fediverse

28744 readers
128 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to !moderators@lemmy.world!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 2 years ago
MODERATORS
 

Note that unless you're a Lemmy instance admin, this doesn't have much use to you.

Until this package came along, if you wanted a bot that responds to events, you had to manually traverse all comments/posts/whatever at a fixed interval. With this package you can actually react to events directly from the database. It's implemented in a very efficient way by connecting the package directly to the Lemmy database and using native Postgres features to get the events (LISTEN/NOTIFY if you want to get technical).

The webhooks themselves are inserted into a separate SQLite database (API is coming) and allow for both simple and complex filtering of the incoming data. The system is already in use by two of my bots, @ChatGPT@lemmings.world and @DallE@lemmings.world who now both receive the information about being tagged in a comment in seconds (the actual reply takes a little longer, but that's because of the nature of the bot).

Currently you can be notified about a post or a comment, other types are trivial to include as well.

Let me know what you think!

you are viewing a single comment's thread
view the rest of the comments
[–] solrize@lemmy.world 1 points 11 months ago (1 children)

I see, that is a good application. How did Reddit deal with this issue? Lemmy does lots of dumb things by comparison it seems to me. I'd be surprised if reddit required constant polling from automods.

[–] rikudou@lemmings.world 1 points 11 months ago (1 children)

No idea, I didn't do any api development with Reddit, it felt way too oversaturated already. But event subscriptions are a common thing for such use-cases, so my guess would be actually very similar to what I have created here with this package.

[–] solrize@lemmy.world 2 points 11 months ago

Fair enough, but it sounds like the subscription feature should really be built into Lemmy's API. That is, your package is a useful workaround for a shortcoming in Lemmy. It's probably worth fixing Lemmy directly