new pipebot things

master
Michael Murtaugh 4 years ago
parent b26490f108
commit 43101d8063

2
.gitignore vendored

@ -1 +1,3 @@
venv/
*.fifo
__pycache__

@ -9,3 +9,29 @@ ircpipebot and reversebot make use of the irc module, installable with:
### Pipebot
Testing
python -u ircpipebot.py | python -u pipebot/echo_split.py
Closing the loop
mkfifo pipe.fifo
cat pipe.fifo | python -u ircpipebot.py > pipe.fifo
cat pipe.fifo | python -u ircpipebot.py | python -u pipebot/echo_split.py > pipe.fifo
or
cat pipe.fifo | \
python -u ircpipebot.py | \
python -u pipebot/echo_split.py \
> pipe.fifo

@ -0,0 +1,4 @@
import sys
for line in sys.stdin:
print (line)

@ -0,0 +1,7 @@
import sys
for line in sys.stdin:
print (line, file=sys.stderr)
time, handle, message = line.split(" ", 2)
message = message.rstrip()
print (f"At {time}, {handle} said: {message}")

@ -0,0 +1,10 @@
import sys
for line in sys.stdin:
print (line, file=sys.stderr)
time, handle, msg = line.split(" ", 2)
if "bot" in msg:
words = msg.split()
words.reverse()
msg = " ".join(words)
print (msg)
Loading…
Cancel
Save