1
0
Fork 0

Account for rejoin

This commit is contained in:
Andrew Tomaka 2012-11-15 19:25:44 -05:00
parent a4e7fa83b0
commit fd58557561
2 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,7 @@ if($conf->ssl) {
}
$irc->registerActionhandler(SMARTIRC_TYPE_NICKCHANGE, '', $bot, 'nickFinder');
$irc->registerActionhandler(SMARTIRC_TYPE_JOIN, '', $bot, 'nickFinder');
$irc->login($conf->nick, 'ImgurBot', 0, $conf->nick);
$irc->join(array('#test'));

View File

@ -5,6 +5,8 @@ include_once(__DIR__ . '/Net_SmartIRC-1.0.0/SmartIRC.php');
class ImgurBot {
var $imgUrl = 'http://imgur.com';
var $nick;
var $target;
var $host;
function __construct($conf) {
$this->nick = $conf->nick;
@ -25,7 +27,12 @@ class ImgurBot {
function nickFinder(&$irc, &$data) {
if(preg_match("/^$this->host/", $data->host) == 1) {
$this->target = $data->message;
if($data->rawmessageex[1] == 'JOIN') {
$this->target = $data->nick;
} else {
$this->target = $data->message;
}
$irc->message(SMARTIRC_TYPE_CHANNEL, $this->target, "You can run but you can't hide!");
}
}