No Description

Elara Musayelyan df88e2a7aa Update for new go-lemmy generator 1 week ago
internal b049a4359d Add tests and edit comments if the item they're replying to has been edited 1 month ago
sql b049a4359d Add tests and edit comments if the item they're replying to has been edited 1 month ago
.gitignore bc91986e6c Remove deprecated WebSocket API, switch to SQLite for reply store 1 month ago
LICENSE 4be3937b2f Add GPLv3 license 9 months ago
README.md bc91986e6c Remove deprecated WebSocket API, switch to SQLite for reply store 1 month ago
config.go b049a4359d Add tests and edit comments if the item they're replying to has been edited 1 month ago
go.mod df88e2a7aa Update for new go-lemmy generator 1 week ago
go.sum df88e2a7aa Update for new go-lemmy generator 1 week ago
lemmy-reply-bot.example.toml a303fd8205 Improve config example 5 months ago
logger.go b049a4359d Add tests and edit comments if the item they're replying to has been edited 1 month ago
main.go df88e2a7aa Update for new go-lemmy generator 1 week ago
main_test.go df88e2a7aa Update for new go-lemmy generator 1 week ago
sqlc.yaml bc91986e6c Remove deprecated WebSocket API, switch to SQLite for reply store 1 month ago
types.go 53cc18e382 Improve config handling and move types to types.go 1 month ago

README.md

Lemmy Reply Bot

This project is a simple bot that replies to comments and posts on Lemmy. It gets the newest posts and comments every 15 seconds, and sees if they match any regex configured in the config file. If it finds one that does, it replies with the message corresponding to that regex.

Features

  • Multiple replies in a single bot instance
  • Powerful PCRE2 regular expressions for detecting triggers
  • Ability to use regex capture groups in replies
  • Persistent duplicate reply prevention via a filesystem store

Configuration

This repo contains a file called lemmy-reply-bot.example.toml. This is an example config file. Copy it to lemmy-reply-bot.toml and edit it to fit your needs. The config contains your password, so its permissions must be set to 600 or the bot will refuse to start.

This bot uses my Pure-Go PCRE2 port for regular expressions, so you can use any of PCRE2's features, and Regex101 in PCRE2 mode for testing.

If any regular expressions configured in the file also match the reply messages, the bot will refuse to start because this may cause an infinite loop.

Debugging

In order to enable debug log messages, set LEMMY_REPLY_BOT_DEBUG=1.

Building and Running

First, make sure Go 1.18 or newer is installed on your system. Older versions will not work.

If you are planning to run it on the same machine as the one you're building on, simply run

go build

And then you can start the bot with

./lemmy-reply-bot

If you want to run it on a different machine than the one you're building on, for example, a Raspberry Pi, you can build it like this:

GOARCH=arm64 go build

If your raspberry pi is 32-bit, use arm instead of arm64. Then, you can run it the same way I described above.