So... another God damned IRC bot, eh?
Yes. I was on the UKNova IRC channel on which they've got a fun little bot that makes announcements and can engage in coversations with people. I thought it was quite fun and remembered "Larry" - a bot written in perl that used to sit on a jukebox server in my old computer science building. Larry could remember things people had told them like "Nirvana is great" (typically!) and recite them to people, e.g.:
Me> What's nirvana? Larry> Apparently Nirvana is great.
Anyway, I decided to write a similar one in PHP for a bit of a joke (which I hadn't thought of a punchline to) and see what the residents of #edge thought of it. After introducing it and #edge teaching it approximately how many people on the channel were gay, I added a few more features:
- Reads TV listings
- You can ask it "What's on tv?" and it will give you a list of all available channels and what's on each (needs XMLTV listings for it to work). You can also ask what's on a specific channel and it will give you a brief list.
- Goes off and googles stuff
- If you ask it a question which it doesn't know the answer to (from its user-taught facts list), it googles using the Google API (API key needed) and gets results back similar to googlism
- Remembers ratings for anything
- You can give it a rating, e.g. "rate Super Mariokart [10/10]" and it will remember the rating and provide an overall average based on all the people that have rated it.
- Responds with a variety of banal one-liners
- This thing is a sentence parser at best - it's not AI. Compared to the standards of most IRC based conversation though, and most of its responses seem eerily human-like...
I'm done playing now. It ended up being a fun lesson in PHP's socket functions, the IRC protocol and the Google API.
The ZIP includes the PHP files (which you run on the command line) and the MySQL data structure.
Download it (44 KB)
downloaded 1279 times





