Lemmy Response Bot ( github.com )

As inspired by the bots on Reddit that respond to certain words, I've thrown together this code which allows anyone to set up their own response bot.

There is a bit more detail on Github, but in summary you can set your own trigger word and responses, and you have two modes of operation, "Exclude" which is the default and covers every community you're federated with (and allows moderators of a community to PM the bot to exclude it) and "Include", where you can pick a single community for the bot to be active in.

This is really early days and rough, but should work at the most basic level. Anyone who can provide some ideas/feedback/improvements - I'm totally open to them.

And to prove it works, I'm running Legolas Bot. Any comment you make below with the word "legolas" in will get a response (probably).

Small updates to reduce spaminess - will only reply to top level comments now.

Edit: Little updates include customisable polling rates and the ability to tag the comment creators name in a response.

keepthepace ,

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.

rikudou ,

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 as well.

keepthepace ,

Thank you good sir/madam! It is thanks to this kind of effort that we are slowly making the fediverse a better place!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • lemmy_integrations@lemmy.dbzer0.com
  • worldmews
  • mews
  • All magazines