I've spent the past couple of days writing my own IRC framework. It has support for "timers" (Either persistent or a set number of times), and is event-based. You could probably make something of a decent bot out of this, though I haven't given it too much testing on the named events.
If anyone wants to give it a try, the source is available at http://www.arloria.net/irc.phps, and an example of how to use it is below:
The IRC object connects on localhost:6667 as Sheeptest, with an ident of "sheep" and a realname of "Test bot", you can move these from the new() to the connect() if you wish, but you will need to call connect() when you want the bot to connect.
Adding the privmsg handle causes it to call test() on all messages it sees, you'll obviously need a function named test() for it to work, else nothing will happen. Similarly, when you receive a CTCP VERSION (You may specify any CTCP you wish. CTCPs start ctcp_event and replies with ctcpreply_event.) the function 'doversion' would be called.
An "alarm" is set to fire three times, once every five seconds. It calls the function 'test' and passes the array of arguments along to it.
All functions called by alarms and events contain a reference to the IRC object as their first argument, which can be used to send data back to the client. Support for most named events beyond "PRIVMSG" and "NOTICE" is untested but should work without issue.
If anyone uses this, or finds bugs in it, then feel free to let me know here or on IRC. If you guys need a version number to feel happy, call it 0.8 and say there's still some room for improvement but it definitely seems to work.
If anyone wants to give it a try, the source is available at http://www.arloria.net/irc.phps, and an example of how to use it is below:
$irc = new irc("localhost", 6667, "sheep", "Test Bot", "Sheeptest");
$irc->handle('privmsg', 'test');
$irc->handle(376, 'dojoin');
$irc->handle('ctcp_version', 'doversion');
$irc->alarm(5, 'test', array("Message test"), 3);
$irc->connect();
$irc->loop();
The IRC object connects on localhost:6667 as Sheeptest, with an ident of "sheep" and a realname of "Test bot", you can move these from the new() to the connect() if you wish, but you will need to call connect() when you want the bot to connect.
Adding the privmsg handle causes it to call test() on all messages it sees, you'll obviously need a function named test() for it to work, else nothing will happen. Similarly, when you receive a CTCP VERSION (You may specify any CTCP you wish. CTCPs start ctcp_event and replies with ctcpreply_event.) the function 'doversion' would be called.
An "alarm" is set to fire three times, once every five seconds. It calls the function 'test' and passes the array of arguments along to it.
All functions called by alarms and events contain a reference to the IRC object as their first argument, which can be used to send data back to the client. Support for most named events beyond "PRIVMSG" and "NOTICE" is untested but should work without issue.
If anyone uses this, or finds bugs in it, then feel free to let me know here or on IRC. If you guys need a version number to feel happy, call it 0.8 and say there's still some room for improvement but it definitely seems to work.