tags:

views:

233

answers:

5

I'm learning Python and would like to start a small project. It seems that making IRC bots is a popular project amongst beginners so I thought I would implement one. Obviously, there are core functionalities like being able to connect to a server and join a channel but what are some good functionalities that are usually included in the bots? Thanks for your ideas.

A: 

I'm also in the process of writing a bot in node.js. Here are some of my goals/functions:

  • map '@' command so the bot detects the last URI in message history and uses the w3 html validation service
  • setup a trivia game by invoking !ask, asks a question with 3 hints, have the ability to load custom questions based on category
  • get the weather with weather [zip/name]
  • hook up jseval command to evaluate javascript, same for python and perl and haskell
  • seen command that reports the last time the bot has "seen" a person online
  • translate command to translate X language string to Y language string
  • map dict to a dictionary service
  • map wik to wiki service
meder
A: 

That is very subjective and totally depends upon where the bot will be used. I'm sure others will have nice suggestions. But whatever you do, please do not query users arbitrarily. And do not spam the main chat periodically.

+1  A: 

Unless it's solely for the educational experience, you should really just use a framework for the core functionality.

That said, here's some of the things the bot in my home IRC channel does:

  • Choose one item from a list of options
  • Display a random entry from the Linux fortunes file
  • Display a random set of words from the Emacs spook file
  • Check every line from a user and display a quote from The Big Lebowski if it's sufficiently similar (this is probably a bit my-channel specific :) )
  • Check if a link has been mentioned before and say who/when (we all read the same RSS feeds and tend to duplicate links a lot)
  • Conduct a poll
  • Pull a given quote from our internal QDB
  • Check if a given link has been posted to Reddit, and give the corresponding Reddit thread link if so. If a Reddit link is posted, give the direct link instead
  • Track the last time a given nick was in the channel, and the last time they spoke
  • Queue a message for an offline nick that's automatically sent in-channel when they join
  • Use Google Translate to translate a given phrase
  • Post a given line to our channel's Twitter feed
  • Choose a random user and kick them (not the best idea depending on how unruly your channel is)
  • Pull the summary of a given term from Wikipedia and display it along with a link to the full article
  • Display information about any posted Youtube link (video title, length, submitter, votes, comments, etc.)
Michael Mrozek
What method do you use to determine similarity for the lebowski quotes?
Daenyth
@Daenyth It keeps ~1500 lines from the movie in an array, and loops over it using the fuzzy [bitap algorithm](http://en.wikipedia.org/wiki/Bitap_algorithm) with `k = 3` to check if the user's string is a fuzzy substring of any of the lines. Bitap is useful because it tells you where the substring is, so the bot can display the complete line from the movie but underline the substring of it that matched what the user said
Michael Mrozek
A: 

Make a google search to get a library that implements IRC protocol for you. That way you only need to add the features, those are already something enough to bother you.

Common functions:

  • Conduct a search from a wiki or google
  • Notify people on project/issue updates
  • Leave a message
  • Toy for spamming the channel
  • Pick a topic
  • Categorize messages
  • Search from channel logs
Cheery
+1  A: 

Again, this is an utterly personal suggestion, but I would really like to see eggdrop rewritten in Python.

Such a project could use Twisted to provide the base IRC interaction, but would then need to support add-on scripts.

This would be great for allowing easy IRC bot functionality to be built upon using python, instead of TCL, scripts.

Martin Eve
I would be interested in getting involved in a project like this as well, not a pro in python but happy to lend a hand.
Chris