Here is an example of what a minimal bot looks like:
<?php
require('protoirc.php');
$irc = new ProtoIRC('nick@hostname:6667', function ($irc) {
// This code will run on connect
$irc->send('JOIN #channel');
});
$irc->in('/^:(.*)!~.* PRIVMSG (.*) :!echo (.*)/', function ($irc, $nick, $channel, $args) {
// Arguments are self documenting
$irc->send($channel, "Echoing '{$args}' for you {$nick}", 'green');
});
// Also available is the ability to catch stdin, irc in, and irc out. Set up timers, and call functions asynchronously (fork/join).
$irc->go();
require('protoirc.php');
$irc = new ProtoIRC('nick@hostname:6667', function ($irc) {
// This code will run on connect
$irc->send('JOIN #channel');
});
$irc->in('/^:(.*)!~.* PRIVMSG (.*) :!echo (.*)/', function ($irc, $nick, $channel, $args) {
// Arguments are self documenting
$irc->send($channel, "Echoing '{$args}' for you {$nick}", 'green');
});
// Also available is the ability to catch stdin, irc in, and irc out. Set up timers, and call functions asynchronously (fork/join).
$irc->go();
Comment on this Post