Esempio n. 1
0
        try {
            $doge->sendtoaddress($msg, $amount);
        } catch (Exception $e) {
            $irc->message(SMARTIRC_TYPE_CHANNEL, GAMECHANNEL, CTRL_B . $data->nick . CTRL_B . ": An internal error occured trying to send your Dogecoins.. Unfortunately, you win nothing.. :(");
            $this->game = false;
            return;
        }
        // aaand kill the game finally
        $this->game = false;
        $irc->message(SMARTIRC_TYPE_CHANNEL, GAMECHANNEL, CTRL_B . $data->nick . CTRL_B . ": You won " . DOGE . $amount . "!");
        file_put_contents("/tmp/moon.info", "");
    }
}
$bot = new monopoly();
$irc = new Net_SmartIRC();
$irc->setDebug(SMARTIRC_DEBUG_NONE);
//$irc->setUseSockets(true);
$irc->setChannelSyncing(true);
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!taketurn$/', $bot, "takeTurn");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!endturn$/', $bot, "endTurn");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!payfine$/', $bot, "payFine");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!usecard$/', $bot, "useCard");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!buy$/', $bot, "buyProperty");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!auction$/', $bot, "auctionProperty");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!bid\\s/', $bot, "bidProperty");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!buildhouse/', $bot, "buildHouse");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!sellhouse/', $bot, "sellHouse");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!mortgage/', $bot, "mortgageProperty");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!unmortgage/', $bot, "unmortgageProperty");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!starttrade/', $bot, "startTrade");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '/^!stoptrade$/', $bot, "stopTrade");
Esempio n. 2
0
    }
}
// load in our required libraries.
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once 'Net/SmartIRC.php';
// prevent MySQL timeouts on slow channels.
db_query('SET SESSION wait_timeout = %d', 24 * 60 * 60);
// initialize the bot with some sane defaults.
global $irc;
// allow it to be slurped by Drupal modules if need be.
$bot = new drupal_wrapper();
// wrapper that integrates with Drupal hooks.
$irc = new Net_SmartIRC();
// MmmmmmM. The IRC object itself. Magick happens here.
$irc->setDebug(variable_get('bot_debugging', 0) ? SMARTIRC_DEBUG_ALL : SMARTIRC_DEBUG_NONE);
// the (boolean) here is required, as Net_SmartIRC doesn't respect a FAPI checkbox value of 1, only TRUE.
$irc->setAutoReconnect((bool) variable_get('bot_auto_reconnect', 1));
// reconnect to the server if disconnected.
$irc->setAutoRetry((bool) variable_get('bot_auto_retry', 1));
// retry if a server connection fails.
$irc->setChannelSyncing(TRUE);
// keep a list of joined users per channel.
$irc->setUseSockets(TRUE);
// uses real sockets instead of fsock().
// send every message type the library supports to our wrapper class.
// we can automate the creation of these actionhandlers, but not the
// class methods below (only PHP 5 supports default methods easily).
$irc_message_types = array('UNKNOWN', 'CHANNEL', 'QUERY', 'CTCP', 'NOTICE', 'WHO', 'JOIN', 'INVITE', 'ACTION', 'TOPICCHANGE', 'NICKCHANGE', 'KICK', 'QUIT', 'LOGIN', 'INFO', 'LIST', 'NAME', 'MOTD', 'MODECHANGE', 'PART', 'ERROR', 'BANLIST', 'TOPIC', 'NONRELEVANT', 'WHOIS', 'WHOWAS', 'USERMODE', 'CHANNELMODE', 'CTCP_REQUEST', 'CTCP_REPLY');
foreach ($irc_message_types as $irc_message_type) {
    $irc->registerActionhandler(constant('SMARTIRC_TYPE_' . $irc_message_type), '.*', $bot, 'invoke_irc_msg_' . strtolower($irc_message_type));
Esempio n. 3
0
            $this->lastadmsg = "";
            return;
        }
        if (substr($admsg, 0, 16) == ">Global Notice< ") {
            $admsg = substr($admsg, 16);
        }
        // to avoid any exploits by that way ;>
        $this->lastadmsg = $admsg;
        $irc->message(SMARTIRC_TYPE_NOTICE, "#dogec0in", $admsg);
        return;
    }
}
date_default_timezone_set("Europe/Berlin");
$bot = new wowsuchdoge();
$irc = new Net_SmartIRC();
$irc->setDebug(0);
//$irc->setUseSockets(true);
$irc->setChannelSyncing(true);
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^identify\\s/', $bot, "msgIdent");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^query(2)?\\s.*/', $bot, "msgQuery");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^ad\\s/', $bot, "msgAd");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^ban\\s/', $bot, "msgBan");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^voice\\s/', $bot, "msgVoice");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^exit\\s/', $bot, "msgExit");
$irc->registerActionHandler(SMARTIRC_TYPE_QUERY, '/^global\\s/', $bot, "msgGlobal");
$irc->registerActionHandler(SMARTIRC_TYPE_CHANNEL, '.*', $bot, "timedChanMsg");
$irc->registerActionHandler(SMARTIRC_TYPE_ACTION, '.*', $bot, "timedChanMsg");
$irc->registerActionHandler(SMARTIRC_TYPE_JOIN, '/\\#dogec0in$/', $bot, "onJoin");
$irc->registerActionHandler(SMARTIRC_TYPE_JOIN, '/\\#dogec0in-vip$/', $bot, "onJoinVip");
$irc->registerActionHandler(SMARTIRC_TYPE_PART, '.*', $bot, "onPart");
$irc->registerActionHandler(SMARTIRC_TYPE_KICK, '.*', $bot, "onKick");