Here's the limited command set:
- !greet - greet user with (one of) their tagline(s)
- !joke - tell a random joke
- !seen (nick) - print last time user was seen (if known by the bot)
- !seen - print entire !seen list
- !link or !url - print a random web link
If you whisper in his ear (via /msg or a query window) you can ident (password) (nick) yourself and claim the accounts I set up for you (and you know who you are). It's perfectly safe - he runs on SSL, too. Better instructions and a few nice operations net yet available via IRC are available at LokiJr's temporary home.
Basically, this is just proof-of-concept stuff, and some framework from which to build bigger and better ideas. The code is a bit of a snarl because I don't have a clue what I'm doing yet, but again, it's really just a prototype. I already have a whole bunch more ideas, and I'm sure you will after you've toyed around with the little bastard yourself.
What's to come:
Better integration with the database: currently there's some stuff that's hardcoded that should be coming out of tables. Ideally, the only items required outside of the database are the database parameters themselves. Once the bot connects to the database, he ought to be able to get everything he needs from there - including the queries he needs to do other things. Rather than message around with SQL statements in the C++ code, I could be debugging him on the fly - re-compiling for an SQL goof seems like a waste of time.
More commands: obvious, but required.
Script interpreters: I spent a little time today messing with perlembed; I'm pretty sure I can graft it on in a day or two. Python can't be far behind. And just because I'm very sick man, I'll probably add the little gem found here: CINT
In the end, you ought to be able to add functionality quite quickly by writing up a script in the language of your choice (no Tcl/Tk - don't even ask), and submitting it to a database table. The bots will occasionally check for updates - probably whenever the server issues a PING - or we'll have a !rehash command or some such.
Questions? Comments? Care hook into my SVN server and help?
I think you may be interested in using Mysql triggers and a User Defined Function (UDF). My understanding is that a UDF is a binary function written in C or C that you can insert into Mysql. Check http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html and http://dev.mysql.com/doc/refman/5.0/en/create-function.html
ReplyDeleteOnce you have the function, you should be able to create a trigger to call that function when the config changes.
Bot looks nice btw - excellent job!
You're absolutely right. MySQL's lack of triggers until the last year or so kind of prevented me from learning anything about them, but they seem like something you'd need in an application such as this. I've had version 5.0 installed for a while, so it seems like now's the time to learn.
ReplyDeleteI'll check out those links - thanks!