intelliproject logo

Location: Web development - Python    License: A Public Domain dedication

Making an Module for Phenny

Posted by Frank

Making an extra module (extra commands) for Phenny the irc-bot.

Skill: Beginner

Posted: 04/12/2008

Views: 417

Rating: 4.00 /5

Popularity: 0.00

Sign Up to vote for this article

Making extra modules for Phenny

Phenny is a simple irc-bit written in Python. And it's not so hard to make an extra module for her. Basic knowledge of Python is enough for simple modules.

Preparations

I'm going to explain how to add an extra module. In this article I'm going to explain how to make the .kill command. Just a command for fun.

.kill is supposed to work like this:

  • If user enter .kill - The bot replies to the user like "User: You died after you saw your website in IE6!"
  • If user enters .kill <username> - The bot says: "<username>: You died after you saw your website in IE6!"
  • If user enters .kill <name of the bot> - The bot says: "Watch out, boy!! >.>"
  • .kill returns a random kill everytime it's called.
  • User can add kills to the database by using .addkill <the kill>.

Should be too hard. ;)

We're going to store the kills in an MySQL database so you need to install MySQLdb first. So read the docs at this website first: http://mysql-python.sourceforge.net/

After you installed MySQLdb you have to install Phenny. Download Phenny from here http://inamidst.com/phenny/ and read README.txt for the installation instructions.

The Code

Create a new MySQL databse (something like 'phenny') and import this SQL:

That is the table that contains all the kills + some free kills from me.

And here is the Python code you need, I have added comments to explain everything:

Put this code in [the folder where phenny is installed]/modules/kill.py and startup Phenny and you can start killing on the irc.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication

About the author

Frank

Location: Netherlands
Ocupation: Still a student. ;)
Home page: http://61924.wepwnyou.net/

Sign up to post message on the article message board!