about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xtracer.py14
-rw-r--r--tracer.service16
2 files changed, 27 insertions, 3 deletions
diff --git a/tracer.py b/tracer.py
index 55a529e..7e1372a 100755
--- a/tracer.py
+++ b/tracer.py
@@ -94,7 +94,7 @@ def fuse(argv):
 
 
 server = "127.0.0.1"
-channels = ["#bots"]
+channels = ["#bots", "#meta", "#team"]
 if len(sys.argv) > 1:
     for c in sys.argv[1:]:
         channels.append("#" + c)
@@ -128,6 +128,13 @@ def think(chan, nick, msg):
                 res = fuse(words[1:])
                 if res:
                     send(chan, res[0:475])
+        elif words[0] == "!!source":
+            send(chan, "https://tildegit.org/ben/tracer")
+        elif words[0] == "!botlist":
+            send(
+                chan,
+                "helo i'm a tracery bot that makes cool things from tracery grammars in your ~/.tracery. see http://tracery.io for more info",
+            )
         elif words[0][0:2] == "!!":
             print(words)
             res = generate(words[0][2:])
@@ -159,7 +166,9 @@ if __name__ == "__main__":
                 for c in channels:
                     rawsend(f"JOIN {c}")
 
-            m = re.match(":(?P<nick>[^ ]+)!.*PRIVMSG #(?P<chan>\w+) :(?P<msg>.*)", ircmsg)
+            m = re.match(
+                ":(?P<nick>[^ ]+)!.*PRIVMSG #(?P<chan>\w+) :(?P<msg>.*)", ircmsg
+            )
             if m and m.groupdict():
                 m = m.groupdict()
                 try:
@@ -167,4 +176,3 @@ if __name__ == "__main__":
                 except Exception as e:
                     print("ERROR" + str(m))
                     print(e)
-
diff --git a/tracer.service b/tracer.service
new file mode 100644
index 0000000..e65f3c7
--- /dev/null
+++ b/tracer.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=tracer
+After=tracer.service
+
+[Service]
+Type=simple
+WorkingDirectory=/home/ben/workspace/tracer
+ExecStart=/home/ben/workspace/tracer/tracer.py
+Restart=always
+RestartSec=5
+StartLimitInterval=60s
+StartLimitBurst=3
+
+[Install]
+WantedBy=default.target
+