Skip to content

Instantly share code, notes, and snippets.

@ecelis
Created June 10, 2015 12:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecelis/11cd74438f94612c715f to your computer and use it in GitHub Desktop.
Save ecelis/11cd74438f94612c715f to your computer and use it in GitHub Desktop.
Thompnson's shell IRC bot
NICK osirz
USER osirz +iw osirz telnet
JOIN #pruebamibot
#!/usr/bin/osh
:
: " The author of this file, Ernesto Celis <ecelis (at) sdf (dot) org>, "
: " hereby grants it to the public domain. "
: " Some ideas taken from http://www.blog.tdobson.net/node/174 "
: " http://web.archive.org/web/20090217181600/http://blog.tdobson.net/node/174 "
:
: " OSh IRCz bot, just for fun! :) "
:
:
: " Config settings, customize to your needs. "
:
: " setenv ircsrv irc.sdf.org <-- This is the server to connect to "
: " setenv ircprt 6667 <-- The port where IRC server listens"
: " setenv ircnik osircz <-- The bot's nick "
:
: " Don't touch anything below unless you really know what you're doing! "
:
: " Only purpose to simulate until loop "
if -f $h/.osirz.run goto Stalebot
touch $h/.osirz.run
cat $h/.osirz.conf > $h/.osirz.in
tail -f $h/.osirz.in | fd2 telnet localhost 6667 \
|awk '!/^:/;{sub(/^PING/,"PONG")};1' >> $h/.osirz.in &
: " goto Exitbot "
: Mainloop
echo ":Im here unenefear" >> $h/.osirz.in
sleep 10
goto Loopiteration
: Loopiteration
goto Mainloop
: Exitbot
echo "Exiting cleanly."
echo "QUIT :See you in the TV" >> $h/.osirz.in
rm $h/.osirz.run
: " rm $h/.osirz.in "
: " rm $h/.osirz.out "
exit 0
: Stalebot
echo $h"/.osirz.run exists, either the bot is already running or it left an stale lock file."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment