================================================================================ Creating a Greeting Bot In our second lesson, we'll create an IRC bot that greets and interacts with users. Copy the code for autogreet.pl to your home folder: $ cp autogreet.pl ~/autogreet.pl Next, open up autogreet.pl using a text editor and make a few changes. (We recommend vim because it provides syntax highlighting) 1. Edit the server in line 89. Replace irc.example.com with the server's real address. NOTE: Only IPv4 is supported. 2. Edit line 92 to replace nickname with the nickname you want for the bot. WARNING: The nickname must not already be taken, or else the bot will fail to connect. 3. Edit line 93 to replace username with the username you want for the bot. The username is what appears in a /whois on IRC; it can be different from the nickname. Next, you'll want to make the perl script executable: $ chmod u+x ~/autogreet.pl Then run the script: $ ~/autogreet.pl On IRC, /join #perl102 Whenever a user joins or parts the channel, the bot will send a message. Try sending a /me action and a notice in the channel tos ee the bot respond. Lastly, try changing your nick or changing the topic in the channel. What happens? ================================================================================ Understanding AutoGreet Next, take a look at the file called ~/comments to see an explanation of key lines in the program. ================================================================================