Learning Python and coding for IRC

Recently, I got the idea into my head that I wanted to learn to program in Python. I’ve already done some VB.NET, C#, C++, Java, Pascal, PHP and a few more that I can’t remember off the top of my head, as I slowly work my way through all the major languages.

I also wanted to code a basic bot for IRC. I borrowed Python for Dummies from my local library, searched Google, and used Wireshark to see what goes on behind-the-scenes with IRC. Whilst I’m still working on my ‘Psyduck’ bot, I thought I would share an uptime bot I made for a fellow Zone-9’er. The bot simply reports the uptime of the machine it’s running from.

To get the bot to identify with NickServ, uncomment lines 12 and 52. This only works under Linux (and possibly other unix-based OSes).

I had the code posted here, until I noticed that WordPress or one of it’s components was stuffing up the indentation – and indentation is critical for a Python program with nested whiles, fors and ifs. Until I can figure out how to get it up here, I’ve uploaded it to Pastebin. The Uptime Bot can be found at http://python.pastebin.com/f51419840

Tip: Apparently Google Chrome has pasting issues with TinyMCE. I can confirm this for Google Chrome (unstable) under Linux – use a different browser when pasting stuff to WordPress.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: