From aade0d53f7b22c7ceb226dd176bc9abab7c24ad7 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 28 May 2019 13:40:51 -0400 Subject: add unit and !botlist --- tracer.py | 14 +++++++++++--- tracer.service | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tracer.service 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[^ ]+)!.*PRIVMSG #(?P\w+) :(?P.*)", ircmsg) + m = re.match( + ":(?P[^ ]+)!.*PRIVMSG #(?P\w+) :(?P.*)", 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 + -- cgit 1.4.1