Created
September 16, 2012 09:44
-
-
Save e2kaneko/3731792 to your computer and use it in GitHub Desktop.
Net_SmartIRCのサンプル。微妙。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // (*´・ω・)(・ω・`*)< イマイチ! | |
| include_once('Net/SmartIRC.php'); | |
| if(count($argv) != 4){ | |
| die("error! invalid argment [php xxx.php 'author' 'log' 'changes']"); | |
| } | |
| class mybot | |
| { | |
| function irc_disconnect(&$irc) | |
| { | |
| global $saytime_once_id; | |
| $irc->unregisterTimeid($saytime_once_id); | |
| $irc->quit('bye'); | |
| } | |
| } | |
| $bot = &new mybot(); | |
| $irc = &new Net_SmartIRC(); | |
| $irc->setDebug(SMARTIRC_DEBUG_NOTICE); | |
| //$irc->setDebug(SMARTIRC_DEBUG_ALL); | |
| $irc->setUseSockets(TRUE); | |
| $saytime_once_id = $irc->registerTimehandler(3000, $bot, 'irc_disconnect'); | |
| // チャンネルにjoin | |
| $irc->connect('irc.server.host', 6667); | |
| $irc->login('svn-bot', 'bot', 8, 'bot'); | |
| $irc->join(array('#sandbox')); | |
| // メッセージ送信 | |
| $message = 'SVN Updated!' . " [" . $argv[1] . "][" . $argv[2] . "][" . $argv[3] . "]"; | |
| $irc->message(SMARTIRC_TYPE_CHANNEL, '#sandbox', $message); | |
| $irc->listen(); | |
| $irc->disconnect(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment