add unit and !botlist

This commit is contained in:
Ben Harris 2019-05-28 13:40:51 -04:00
parent 73945d8ec2
commit aade0d53f7
2 changed files with 27 additions and 3 deletions

View File

@ -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)

16
tracer.service Normal file
View File

@ -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