The idea here is to take lalita , which is already an easy-to-use irc bot, and make it easy for someone completely new to programming to write an IRC bot.
- download this project (use the “Download Source” button up top in github) and untar or unzip it
- optional: this gets you a “sandboxed” python install, so you can install whatever other stuff you need
- download virtualenv
- run
virtualenv.py sandbox
- run
source sandbox/bin/activate
- run
python setup.py develop
- run
introbot channelname
. Your bot will appear in #channelname on freenode. - you can ping the bot in IRC with something like “dustinbot: ping”
- open
introbot/actions.py
and edit it. Don’t look at the other files – they are not introductory-level. - to run your bot without an IRC server, run
textbot
instead.
- Use ‘if’ statemnts to respond to some commands like “dance” or “yo mamma”
- use string operations to break commands apart:
split
orstartswith
- use string operations to break commands apart:
- Use the random.choice function to choose a random quote on request
- Use a dictionary to give answers to questions posed in IRC
- Reply to everything in ROT13