And to prove it works: legolas
Lemmy Integrations
A community about all integrations with the lemmy API. Bots, Scripts, New Apps, etc.
This Is No Mere Ranger. He Is Aragorn, Son Of Arathorn. You Owe Him Your Allegiance.
Looking at the code, it seems to download the 25 newest comments every 5 seconds from the instance it is configured to go through. I understand that this is probably the easiest way to go, but that sounds also like a lot of useless traffic by downloading the same messages over and over. Isn't there a way to make it more efficient and get only the unread messages? Lemmy does not support that? I guess one would need to fiddle in the code of an instance to do that efficiently.
It's in json format so in reality it's very little data. There's no way (that I know of) to grab only "new" comments - I don't think the lemmy api has anything like that.
Even if you put seen comments in a db you've still got to pull them to check if they've been seen or not which defeats the object.
25 every 5 seconds might be a touch overkill too but it does stop the bot missing any comments. I can certainly move them to variables that can be set in the env file/docker.
Edit to add: if it is locked down to one community then yes its way overkill, so will add them as variables and update docs to reflect.
I see, thanks. I guess at one point if it becomes problematic, instances can add hooks or light-weight calls.
I've pushed the change so operators can change those values in the env file or via docker. Btw let me know if you do start work on the megathread thing, it does pose an interesting challenge in terms of structuring posts and handling that data.
That's exactly what my package which adds webhooks to Lemmy is for. It allows you to listen for events (like a new comment) and react to that. It even allows filtering, so you can filter for comments containing "legolas" at the webhook level and you only receive the event if it's there. More info here.
Tagging @Demigodrick@lemmy.zip as well.
Thank you good sir/madam! It is thanks to this kind of effort that we are slowly making the fediverse a better place!
Well nice! legolas would be proud of you (:
This Is No Mere Ranger. He Is Aragorn, Son Of Arathorn. You Owe Him Your Allegiance.
Apparently legolas likes to repeat himself
This Forest Is Old. Very Old. Full Of Memories...And Anger.
We must move on. We cannot linger.
Does the legolas bot run in exclusive or inclusive mode?
I do not wish to go to Moria.
Exclusive, it is currently active across all of lemmy and mods can pm it to exclude their community from it.
Ok
Thanks for doing that! It could be the template for a megathread-managing bot that was required a few days ago but I did not feel like starting to work on. You make it much easier!