IRC Bot to Post Links to Delicious


I lurk in an IRC chatroom with some friends and throughout the course of a day a lot of links are posted.

I wanted to be able to catch up on the links without having to read through the entire channel backlog, so I hacked together a new module for Phenny (a Python IRC bot) which posted the links to a Delicious account. I subscribe to that account via Google Reader, and read through the latest Internet memes at my leisure. :)

To use my little hack:

  1. Install pydelicious
  2. Install Phenny
  3. copy the following code into a new file: modules/
    #!/usr/bin/env python
    “”” - Automatically post URLs to delicious
    Author: Michael Schurter,
    License: Public Domain

import re import pydelicious

r = re.compile(r’http\S*‘)

def f_delicious(self, origin, match, args): try: matches = r.findall( if matches: d = pydelicious.DeliciousAPI(‘DELICIOUS_USERNAME’, ‘DELICIOUS_PASSWORD’) for url in matches: title = ‘%s: %s’ % (origin.nick, if len(title) > 50: title = ‘%s…’ % title[:50] d.posts_add( url=url, description=title,, # Add custom tags below tags=‘oggbot oggbot-added-by:%s’ % origin.nick ) except: self.msg(origin.sender, ‘Oops! Missed that one. Blame schmichael!’) f_delicious.rule = r’.*’

  1. Fill in delicious account information in the obvious place.
  2. Start/Restart Phenny and watch posted links appear in delicious.

There’s lots of room for improvement in the code, but it works for me!

Sorry for poor tab spacing. I had vim configured for some Drupal hacking and forgot to switch back to 4-space tabs.