shorter swapping algo and !!help

This commit is contained in:
Ben Harris 2019-05-28 13:47:59 -04:00
parent aade0d53f7
commit 0d3ced567c
1 changed files with 3 additions and 4 deletions

View File

@ -71,9 +71,7 @@ def shuffle(col):
if "origin" in [a, b]: if "origin" in [a, b]:
print("origin discard") print("origin discard")
return col return col
temp = col[a] col[a], col[b] = col[b], col[a]
col[a] = col[b]
col[b] = temp
return col return col
@ -130,7 +128,7 @@ def think(chan, nick, msg):
send(chan, res[0:475]) send(chan, res[0:475])
elif words[0] == "!!source": elif words[0] == "!!source":
send(chan, "https://tildegit.org/ben/tracer") send(chan, "https://tildegit.org/ben/tracer")
elif words[0] == "!botlist": elif words[0] == "!botlist" or words[0] == "!!help":
send( send(
chan, chan,
"helo i'm a tracery bot that makes cool things from tracery grammars in your ~/.tracery. see http://tracery.io for more info", "helo i'm a tracery bot that makes cool things from tracery grammars in your ~/.tracery. see http://tracery.io for more info",
@ -165,6 +163,7 @@ if __name__ == "__main__":
if "001" in ircmsg: if "001" in ircmsg:
for c in channels: for c in channels:
rawsend(f"JOIN {c}") rawsend(f"JOIN {c}")
rawsend(f"MODE {botnick} +B")
m = re.match( m = re.match(
":(?P<nick>[^ ]+)!.*PRIVMSG #(?P<chan>\w+) :(?P<msg>.*)", ircmsg ":(?P<nick>[^ ]+)!.*PRIVMSG #(?P<chan>\w+) :(?P<msg>.*)", ircmsg