1
0
Fork 0
ImgurIRCBot/bot.php

26 lines
760 B
PHP
Raw Normal View History

2012-11-15 01:34:24 -05:00
<?php
include_once(__DIR__ . '/lib/imgurbot.php');
$conf = json_decode(implode("\n", file(__DIR__ . '/conf/settings.conf')));
$bot = &new ImgurBot($conf);
$irc = &new Net_SmartIRC();
if($conf->debug) $irc->setDebug(SMARTIRC_DEBUG_ALL);
2012-11-15 10:48:27 -05:00
$irc->registerTimehandler($conf->timing, $bot, 'randomTop');
2012-11-15 01:34:24 -05:00
if($conf->ssl) {
$irc->setUseSockets(FALSE);
$irc->connect('ssl://' . $conf->server, $conf->port);
} else {
$irc->setUseSockets(TRUE);
$irc->connect($conf->server, $conf->port);
}
2012-11-15 18:55:19 -05:00
$irc->registerActionhandler(SMARTIRC_TYPE_NICKCHANGE, '', $bot, 'nickFinder');
2012-11-15 19:25:44 -05:00
$irc->registerActionhandler(SMARTIRC_TYPE_JOIN, '', $bot, 'nickFinder');
2012-11-15 18:55:19 -05:00
2012-11-15 01:34:24 -05:00
$irc->login($conf->nick, 'ImgurBot', 0, $conf->nick);
2012-11-15 18:55:19 -05:00
$irc->join(array('#test'));
2012-11-15 01:34:24 -05:00
$irc->listen();
$irc->disconnect();