Created
October 30, 2012 09:07
-
-
Save eldstal/3979151 to your computer and use it in GitHub Desktop.
A simple IRC bot. Join, spam, disconnect.
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
#!/bin/bash | |
# $1: The nickname to use | |
function ircpreamble { | |
echo "NICK ${1}" | |
echo "USER ${1} 0 * :Totally not a spambot" | |
} | |
# $1: Channel to join | |
function channel { | |
echo "JOIN ${1}" | |
} | |
# stdin: a stream where each line is converted to a message | |
# $1: The user/channel to send to | |
function privmsg { | |
TARGET=$1 | |
sed -re "s/^(.*)\$/PRIVMSG ${TARGET} :\1/" | |
} | |
# Curtail spam protection | |
function delay { | |
while read LINE; do | |
sleep 2 | |
echo $LINE | |
done | |
} | |
# Replace with reading your file or whatever | |
function messages { | |
echo "spam spam spam" | |
echo "lovely spam" | |
} | |
function disconnect { | |
echo "QUIT no more spam" | |
} | |
( | |
ircpreamble "FarbrorAlBot"; | |
channel "#megabice"; | |
messages | privmsg "#megabice"; | |
disconnect; | |
) | delay | nc irc.freenode.net 6667 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment