Ejemplo n.º 1
0
 /**
  * Method used to send a message to the given target.
  *
  * @param string $target The target for this message
  * @param string|string[] $response The message to send
  * @param integer $priority the priority level of the message
  */
 protected function sendResponse($target, $response, $priority = SMARTIRC_MEDIUM)
 {
     if (substr($target, 0, 1) != '#') {
         $type = SMARTIRC_TYPE_QUERY;
     } else {
         $type = SMARTIRC_TYPE_CHANNEL;
     }
     $this->irc->message($type, $target, $response, $priority);
 }
Ejemplo n.º 2
0
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!delcash.*/', $bot, "delCash");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!addcard.*/', $bot, "addCard");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!delcard.*/', $bot, "delCard");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!dotrade$/', $bot, "doTrade");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!denytrade$/', $bot, "denyTrade");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!accepttrade$/', $bot, "acceptTrade");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!tradeinfo$/', $bot, "tradeInfo");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!gameinfo$/', $bot, "gameInfo");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!startgame$/', $bot, "startGame");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!stopgame\\s/', $bot, "stopGame");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!joingame$/', $bot, "joinGame");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!bankrupt$/', $bot, "bankrupt");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!help$/', $bot, "help");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!winneraddress/', $bot, "winnerAddress");
$irc->registerActionHandler(SMARTIRC_TYPE_JOIN, '.*', $bot, "onJoin");
$irc->registerActionHandler(SMARTIRC_TYPE_PART, '.*', $bot, "onQuit");
$irc->registerActionHandler(SMARTIRC_TYPE_KICK, '.*', $bot, "onKick");
$irc->registerActionHandler(SMARTIRC_TYPE_QUIT, '.*', $bot, "onQuit");
$irc->registerActionHandler(SMARTIRC_TYPE_NICKCHANGE, '.*', $bot, "onNickChange");
while (1) {
    $irc->connect("localhost", 7000, true);
    $irc->login("moonopoly", "The Dogecoin Property Trading Game", 8, "tothemoon", '');
    $irc->send("oper username password");
    // oline
    $irc->send("part #services :");
    $irc->message(SMARTIRC_TYPE_QUERY, "nickserv", "identify password");
    $irc->join(array(GAMECHANNEL));
    $irc->send("samode " . GAMECHANNEL . " +Y moonopoly");
    $irc->listen();
    $irc->disconnect();
}