summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/news.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-01-21 17:58:27 +0100
committerlassulus <lassulus@lassul.us>2021-01-21 17:58:27 +0100
commitf4846c2f93df980944ef583e8e593639f8ce3964 (patch)
tree4b171d699a6d2432535b4f61ade98923a5360e0d /krebs/2configs/news.nix
parent8d6a964c86d7a556cce6180a77a4828d4a93fe90 (diff)
news: add brockman-helper reaktor2 bot
Diffstat (limited to 'krebs/2configs/news.nix')
-rw-r--r--krebs/2configs/news.nix53
1 files changed, 51 insertions, 2 deletions
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix
index f40997f82..04a843922 100644
--- a/krebs/2configs/news.nix
+++ b/krebs/2configs/news.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
{
services.rss-bridge = {
@@ -22,7 +22,6 @@
"d /var/lib/brockman 1750 brockman nginx -"
];
- systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG";
krebs.brockman = {
enable = true;
config = {
@@ -36,4 +35,54 @@
bots = {};
};
};
+
+ krebs.reaktor2.news = {
+ hostname = "localhost";
+ port = "6667";
+ nick = "brockman-helper";
+ plugins = [
+ {
+ plugin = "register";
+ config = {
+ channels = [
+ "#all"
+ "#aluhut"
+ "#news"
+ ];
+ };
+ }
+ {
+ plugin = "system";
+ config = {
+ hooks.PRIVMSG = [
+ {
+ activate = "match";
+ pattern = "^(?:.*\\s)?\\s*brockman-helper:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
+ command = 1;
+ arguments = [2];
+ commands = {
+ add-telegram.filename = pkgs.writeDash "add-telegram" ''
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: add-telegram $telegramname'
+ echo "$#"
+ exit 1
+ fi
+ echo "brockman: add t_$1 http://rss.r/?action=display&bridge=Telegram&username=$1&format=Mrss"
+ '';
+ search.filename = pkgs.writeDash "search" ''
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: brockman-helper: search $searchterm'
+ echo "$#"
+ exit 1
+ fi
+ ${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$1&info=true&favicon=false" | \
+ ${pkgs.jq}/bin/jq '.[].url'
+ '';
+ };
+ }
+ ];
+ };
+ }
+ ];
+ };
}