Created
June 10, 2015 12:24
-
-
Save ecelis/11cd74438f94612c715f to your computer and use it in GitHub Desktop.
Thompnson's shell IRC bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NICK osirz | |
USER osirz +iw osirz telnet | |
JOIN #pruebamibot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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