summaryrefslogtreecommitdiffstats
path: root/lass/2configs/reaktor-coders.nix
blob: 457d5b6c7c4af4efd07df3b6790d653873581e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;

let
  hooks = pkgs.reaktor2-plugins.hooks;
in {
  krebs.reaktor2.coders = {
    hostname = "irc.hackint.org";
    port = "9999";
    useTLS = true;
    nick = "reaktor2|lass";
    plugins = [
      {
        plugin = "register";
        config = {
          channels = [
            "#coders"
            "#germany"
            "#panthermoderns"
          ];
        };
      }
      {
        plugin = "system";
        config = {
          workdir = config.krebs.reaktor2.coders.stateDir;
          hooks.PRIVMSG = [
            hooks.sed
            hooks.url-title
            {
              activate = "match";
              pattern = ''^!([^ ]+)(?:\s*(.*))?'';
              command = 1;
              arguments = [2];
              commands = {
                ping.filename = pkgs.writeDash "ping" ''
                  exec /run/wrappers/bin/ping -q -c1 "$1" 2>&1 | tail -1
                '';
                google.filename = pkgs.writeDash "google" ''
                  exec ${pkgs.ddgr}/bin/ddgr -C -n1 --json "$@" | \
                    ${pkgs.jq}/bin/jq '@text "\(.[0].abstract) \(.[0].url)"'
                '';
                shrug.filename = pkgs.writeDash "shrug" ''
                  exec echo '¯\_(ツ)_/¯'
                '';
                table.filename = pkgs.writeDash "table" ''
                  exec echo '(╯°□°)╯ ┻━┻'
                '';
              };
            }
          ];
        };
      }
    ];
  };
}