Changeset 98 for devel/www/chat/irc_bot.php
- Timestamp:
- Jul 31, 2008, 4:13:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/www/chat/irc_bot.php
r94 r98 1 1 <?php 2 2 3 // PHP IRC bot 4 // Based on HARVESTER IRC BOT by Harvie 3 include('../global.php'); 5 4 6 5 class IRCBot … … 10 9 var $Port = 6667; 11 10 var $Channel = "#zdechov"; 12 var $Nick = " BigBrother";11 var $Nick = "History"; 13 12 var $JokeFileName = "jokes.txt"; 14 13 var $File; … … 42 41 function Run() 43 42 { 43 global $Database; 44 44 45 while(!fwrite($this->File, '')) 45 46 { … … 70 71 } 71 72 73 // Log messages to database 74 if(strpos($Line, 'PRIVMSG') !== false) 75 { 76 $LineParts = explode(':', $Line); 77 $Text = $LineParts[2]; 78 $LineParts2 = explode(' ', $LineParts[1]); 79 $LineParts3 = explode('@', $LineParts2[0]); 80 $Host = $LineParts3[1]; 81 $LineParts4 = explode('!', $LineParts3[0]); 82 $Nick = $LineParts4[0]; 83 $Database->insert('ChatHistory', array('Nick' => $Nick, 'Text' => $Text, 'Host' => $Host, 'Time' => 'NOW()', 'RoomName' => 'Všichni')); 84 } 85 72 86 $Commands = explode(':', $Line); 73 87 foreach($Commands as $Index => $Item) … … 90 104 $this->Say('Ja jsem Harvester.'); 91 105 /* 92 irc_say( $sfp, " Harvester- Posle vizitku", $nick, $channel );106 irc_say( $sfp, "Bot - Posle vizitku", $nick, $channel ); 93 107 irc_say( $sfp, "hhelp - vypise tuto napovedu", $nick, $channel ); 94 108 irc_say( $sfp, "hsay:Message - Posle zpravu", $nick, $channel );
Note:
See TracChangeset
for help on using the changeset viewer.