diff --git a/.gitignore b/.gitignore index 170b4bc..fc81128 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -config.js +/config.js node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a978880 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# XMPP Lightning Anti-Spam + +In order to combat spam in public chat rooms, they can be configured so that +new, unknown participants have to request voice before being able to write +messages (known as a "moderated channel"). + +This bot listens to those voice requests, and when it sees one, it sends a +direct message to the user, which offers to give them voice immediately, in +exchange for a small amount of sats[^1], payable via the Lightning Network[^2]. + +## Requirements + +* [Node.js](https://nodejs.org) and [NPM](https://www.npmjs.com) +* An XMPP account, which has admin permissions for the channels you want it to + manage voice requests in +* A hosted Lightning Network account compatible with LndHub clients (e.g. a + [Kosmos](https://kosmos.org) or [Alby](https://getalby.com/) + account, or self-hosted with + [lndhub.go](https://github.com/getAlby/lndhub.go)). + +## Setup + +Clone this repository: + + git clone https://gitea.kosmos.org/raucao/xmpp-lightning-antispam.git + +Install required dependencies: + + npm install + +Create a config file from the included sample: + + cp samples/config.js config.js + +Edit the config file using your favorite editor: + + vim config.js + +Start the program: + + npm start + +## Deployment + +Set up as described above, or use a cloud platform instead. + +An example for a systemd service can be found in +`samples/xmpp-lightning-antispam.service`. + +## Contact + +E-Mail, Chat, Lightning: raucao@kosmos.org + +[^1]: Sats are the smallest unit of bitcoin (1 sat = 0.00000001 BTC) +[^2]: The Lightning Network is a peer-to-peer network for instantly and very + cheaply sending and receiving bitcoin directly between nodes diff --git a/package.json b/package.json index 17c2841..af5bd01 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "xmpp-lightning-antispam", "version": "1.1.0", - "description": "", + "description": "A bot for moderated XMPP channels, offering voice for Lightning donations", "main": "index.js", "type": "module", "scripts": { + "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Râu Cao", diff --git a/config.js.sample b/samples/config.js similarity index 100% rename from config.js.sample rename to samples/config.js diff --git a/samples/xmpp-lightning-antispam.service b/samples/xmpp-lightning-antispam.service new file mode 100644 index 0000000..5701025 --- /dev/null +++ b/samples/xmpp-lightning-antispam.service @@ -0,0 +1,13 @@ +[Unit] +Description=XMPP Lightning Antispam bot +After=network.target + +[Service] +Type=simple +User=deploy +WorkingDirectory=/opt/xmpp-lightning-antispam +ExecStart=/usr/bin/node index.js +Restart=on-failure + +[Install] +WantedBy=multi-user.target