|
|
|
|
Jabber trivia BotJune 2005Background:A few years ago I used to enjoy logging into an IRC server and joining a room that contained a bot that would ask trivia, give hints and hand out points to the first person to get each question right. I had a blast, but, after a while the trivia bots moved around and I lost interest in IRC. Then a friend showed me Jabber. Jabber is a protocol that joins together all of the mainstream IM clients as well as intigrating a multi-user chat similar to IRC. Pretty soon I had a hankering again for Trivia.The Problem:Write a Trivia Bot that enteres a jabber chat room and asks trivia questions.The solution:I checked the www.jabber.org website and found the different language libraries to use to program jabber things. I noticed there were some Perl libraries and decided this would be a good project to hone my Perl skills on.I did some pretty heavy searching and could not find any jabber trivia bot programs. I did, however, find plenty of trivia questions that would be easy for me to use for my trivia bot. I also found Jarl (a jabber client written in perl). I dove into Jarl to try to figure out how it worked and didn't come up with much. It ended up that Jarl uses a Perl jabber library that is a little more combersome than I was comfortable with. I then started taking a look at the actual libraries themselves, as well as the Jabber protocols. Finally I figured out how to do some rudamentary Jabber things. The coding process was pretty simple. I wrote up an outline of the program's flow. From there, it was pretty straight forward to write the program. In a couple hours I had the entire program except for the Jabber communication parts. I then wrote a simple program that would log a user into a jabber server. Then the program would log that user into a jabber chat room. While in the chat room, the program would simple echo everything that anyone else said in that chatroom. Once I had that program I had pretty much everything that I needed to put the finishing touches on my trivia bot. I threw everything together, tweaked a few things to do with timing and points, and I was good to go. Download SpicyTriviaBot.zip to get everything you'll need for this trivia bot. It is written to be run at a linux command line and has not been tested in other environments. If you only want some of the components they are here. What I learned:This project helped solidify my perl programing abilitys. I also learned how to interpret protocals. I also learned that left handed people live an average of 9 years less than right handed people. Here also, are each of the packages individually. Update (September 2008):I got back into this a little bit and decided to update it a bit. The biggest update is that I added the all important "use strict;" line to it. I've also fixed a couple bugs related to resetting scores. I've added a couple new features as well. There's some more stuff I'd like to add or change dealing with a regulars lists and invites. I would also like to add some stuff dealing with whispering, such as the admin commands. I would also like to update the ini file a little bit to make it easier to know how to configure.Anyway, I just figured I'd throw an update up here since it seems to be fairly popular. If you have any questions/suggestions/requests feel free to email me a trivia@wedul.com.
page last updated September 2008 |
[Home]
[About me]
[My projects]
[Resume]
[In the works]
[online diary]
[TV mount]
[Diffusion]
[N-body]
[Vote Montana]
[Climate Model]
[Portfolio]
[Quantum Computers]
[Poker]
[Triviabot]
[Website Creator]
[Movies]
Site Last Updated February 02, 2010