Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit( 0 ); // Maximum time of execution
- error_reporting( 0 ); // Not show errors
- class zBot
- {
- /* Sample config */
- public $Weoxolink = "http://localhost";
- public $user = "Bot2"; // BOT Username
- public $pass = "Option"; // Bot Password
- public $chat = "Chat"; // Chat Room Name
- /* Remember that the BOT 's account must have everypower! */
- public $name = "Planets(tickle#noel#ffffff#f#topspin#w6#offset#w6351)[ID:368](Planets)(text#ffffff#0015ff)"; // Bot Nick Name
- public $hat = "(hat#f#0015ff)"; // Bot Hat Code
- public $glow = "(glow#0015ff#ffffff)"; // Bot NameColor/NameGlow
- public $status = "Price: 500 | Limited"; // Bot Status
- public $statusglow = "0015ff"; // Bot StatusGlow
- public $statuscolor = "ffffff"; // Bot StatusColor
- public $textcolor = "(text#ffffff#000001)"; // BOt TextColor
- public $avatar = "(randomplanets)"; // BOT Avatar
- public $home = ""; // BOT Homepage
- public $maxKicks = 4; //Number of kicks before ban
- public $admins = Array( 5,815,256,100 ); // IDs with bot access example Array(42,100,96218942); etc...
- public $semacesso = "You dont allowed use commands!"; //Message without access..
- public $autoWelcome = "Welcome to Weoxo ! Register your Account and get Free Coins And Days "; // Welcome message for users
- public $automember = True; // True = activated, False = deactivated
- public $autoguest = False; // True = activated, False = deactivated
- public $censor = array("fuck","bitch","motherfucker","penis","pussy");
- public $censor2 = array("test","hehe","hey","hi");
- public $radioinfo = 'semnome';
- /* Extra */
- public $users;
- public $logado;
- public $socket;
- public $chatID ;
- public $botID ;
- public $port ="1204";
- public $ip ="localhost";
- public $k;
- /* Function to connect with Weoxo.com*/
- public function conectar( )
- {
- $this->getinfo();
- $this->socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
- $test = socket_connect( $this->socket, $this->ip, $this->port );
- echo "--> Connecting {$this->ip}:{$this->port}...\n";
- If ( !$test ) {
- die( "<-- Failed Connection!\n" );
- } //!$test
- }
- /* Function to disconnect [ used to debug ] */
- public function desconectar( )
- {
- If ( isset( $this->socket ) && $this->socket == True )
- socket_close( $this->socket );
- $this->socket = False;
- }
- /* Function to get informations about the bot User... */
- function getinfo( )
- {
- $curl = curl_init( $this->Weoxolink . "/mobile?" . time() );
- curl_setopt( $curl, CURLOPT_RETURNTRANSFER, True );
- curl_setopt( $curl, CURLOPT_POST, True );
- curl_setopt( $curl, CURLOPT_POSTFIELDS, "username={$this->user}&password={$this->pass}&room={$this->chat}" );
- $url = curl_exec( $curl );
- $parte1 = explode( "\"id\":\"", $url );
- $id = explode( "\"", $parte1[ 1 ] );
- $this->botID = $id[ 0 ];
- $parte2 = explode( "\"k\":\"", $url );
- $k = explode( "\"", $parte2[ 1 ] );
- $this->k = $k[ 0 ];
- $parte3 = explode( "'<y r=\"", $url );
- $chat_data = explode('c="', $url);
- $chatID = explode('"', $chat_data[1]);
- $this->chatID = $chatID[0];
- $parte4 = explode( "WebSocket('ws://", $url );
- $ip = explode( ":", $parte4[ 1 ] );
- $this->ip = $ip[ 0 ];
- $dx_data = explode("\"xats\":\"", $url);
- $dx = explode("\"", $dx_data[1]);
- $this->dx = $dx[0];
- $d1_data = explode("\"days\":\"", $url);
- $d1 = explode("\"", $d1_data[1]);
- $this->d1 = $d1[0];
- $d4_data = explode('"p4":', $url);
- $d4 = explode(',"', $d4_data[1]);
- $this->d4 = $d4[0];
- $d5_data = explode('"p5":', $url);
- $d5 = explode(',"', $d5_data[1]);
- $this->d5 = $d5[0];
- $d6_data = explode('"p6":', $url);
- $d6 = explode(',"', $d6_data[1]);
- $this->d6 = $d6[0];
- $d7_data = explode('"p7":', $url);
- $d7 = explode(',"', $d7_data[1]);
- $this->d7 = $d7[0];
- $d8_data = explode('"p8":', $url);
- $d8 = explode(',"', $d8_data[1]);
- $this->d8 = $d8[0];
- $d9_data = explode('"p9":', $url);
- $d9 = explode(',"', $d9_data[1]);
- $this->d9 = $d9[0];
- $d10_data = explode('"p10":', $url);
- $d10 = explode(',"', $d10_data[1]);
- $this->d10 = $d10[0];
- $d11_data = explode('"p11":', $url);
- $d11 = explode(',"', $d11_data[1]);
- $this->d11 = $d11[0];
- $d12_data = explode('"p12":', $url);
- $d12 = explode(',"', $d12_data[1]);
- $this->d12 = $d12[0];
- $d13_data = explode('"p13":', $url);
- $d13 = explode(',"', $d13_data[1]);
- $this->d13 = $d13[0];
- $d14_data = explode('p14":', $url);
- $d14 = explode(',"', $d14_data[1]);
- $this->d14 = $d14[0];
- $d15_data = explode('p15":', $url);
- $d15 = explode('}', $d15_data[1]);
- $this->d15 = $d15[0];
- $parte5 = explode( $this->ip . ":", $url );
- $port = explode( "/", $parte5[ 1 ] );
- $this->port = $port[ 0 ];
- If ( empty( $url ) ) {
- die( "<-- Connection failed, or the website could be closed!!\n" );
- } //empty( $url )
- If ( empty( $this->botID ) ) {
- die( "<-- The chat doesn't exist, or the data is incorrect!\n" );
- } //empty( $this->botID )
- }
- /* Passing XML code to catch B1 and B2 */
- public function passXML( $xml, $return = null )
- {
- $content = @simplexml_load_string( trim( $xml ) );
- Foreach ( $content->Attributes() as $i => $u )
- $return[ $i ] = (string) ( (string) $u );
- return $return;
- }
- /* Send obvious packets ._. */
- public function enviar( $packet )
- {
- If ( $packet[ strlen( $packet ) - 1 ] != chr( 0 ) )
- $packet .= chr( 0 );
- echo "[BOT]-> {$packet}\n";
- return socket_write( $this->socket, $packet, strlen( $packet ) );
- }
- /* Weoxo not enter group */
- public function entrar( )
- {
- $this->conectar();
- $this->enviar( "<y r=\"{$this->chatID}\" />" );
- $x = $this->passXML(socket_read($this->socket, 10090));
- $b1 = floor(2 << ($x["yi"] % 94)) % $x["yc"] + $x["yi"];
- $b2 = floor(pow(2, $x["ys"] % 27));
- $j2 = "cb=\"0\" ";
- $j2 .= "auth1=\"{$b1}\" ";
- $j2 .= "auth2=\"{$b2}\" ";
- $j2 .= "y=\"{$x[ 'yi' ]}\" ";
- $j2 .= "k=\"{$this->k}\" ";
- $j2 .= "k3=\"0\" ";
- $j2 .= "d1=\"{$this->d1}\" ";
- $j2 .= "p=\"0\" ";
- $j2 .= "c=\"{$this->chatID}\" ";
- $j2 .= "f=\"8192\" ";
- $j2 .= "u=\"{$this->botID}\" ";
- $j2 .= "m6=\"131072\" ";
- $j2 .= "d0=\"0\" ";
- $j2 .= "d2=\"0\" ";
- $j2 .= "d4=\"{$this->d4}\" ";
- $j2 .= "d5=\"{$this->d5}\" ";
- $j2 .= "d6=\"{$this->d6}\" ";
- $j2 .= "d7=\"{$this->d7}\" ";
- $j2 .= "d8=\"{$this->d8}\" ";
- $j2 .= "d9=\"{$this->d9}\" ";
- $j2 .= "d10=\"{$this->d10}\" ";
- $j2 .= "d11=\"{$this->d11}\" ";
- $j2 .= "d12=\"{$this->d12}\" ";
- $j2 .= "d13=\"{$this->d13}\" ";
- $j2 .= "d14=\"{$this->d14}\" ";
- $j2 .= "d15=\"{$this->d15}\" ";
- $j2 .= "N=\"{$this->user}\" ";
- $j2 .= "n=\"{$this->name}{$this->hat}{$this->glow}##{$this->status}#{$this->statusglow}#{$this->statuscolor}\" ";
- $j2 .= "a=\"{$this->avatar}\" ";
- $j2 .= "h=\"{$this->home}\" ";
- $j2 .= "v=\"0\"";
- $j2 = "<j2 {$j2} />";
- $this->enviar( $j2 );
- }
- /* load packets */
- public function load( $check = True, $test_var = True )
- {
- $x = "";
- try {
- $x = rtrim( socket_read( $this->socket, 2048 ) );
- $x = str_replace( "", "", $x );
- }
- catch ( Exception $e ) {
- return "OFF";
- }
- If ( !$x )
- return "OFF";
- If ( $x[ strlen( $x ) - 1 ] != ">" )
- $x .= $this->load( True );
- If ( $check )
- $this->packets( $x, $test_var );
- return $x;
- }
- /* show packets etc... */
- public function packets( $packet, $test = True, $test2 = False )
- {
- If ( substr_count( $packet, ">" ) > 1 ) {
- $packet = explode( "/>", $packet );
- $test2 = True;
- } //substr_count( $packet, ">" ) > 1
- Foreach ( (Array) $packet as $p ) {
- If ( $test2 )
- $p .= "/>";
- $p = trim( $p );
- If ( strlen( $p ) < 5 )
- return;
- echo "[WEOXO]-> {$p}\n";
- $tipo = trim( strtolower( substr( $p, 1, strpos( $p . " ", " " ) ) ) );
- $p = trim( str_replace( "<" . $tipo, "", str_replace( "/>", "", $p ) ) );
- $p = str_replace( "\"", "", str_replace( "\" ", "&", str_replace( "&", "__38", $p ) ) );
- parse_str( $p, $this->packet[ $tipo ] );
- Foreach ( $this->packet[ $tipo ] as $x => $v )
- $this->packet[ $tipo ][ $x ] = str_replace( "__38", "&", str_replace( "pl_", "+", $v ) );
- If ( $test )
- $this->tipos( $tipo, $this->packet[ $tipo ] );
- } //(Array) $packet as $p
- }
- /* Some types of packets and commands can be added here ! */
- public function tipos( $tipo, $packet )
- {
- switch ( $tipo ) {
- /* Packets */
- case 'u':
- $u = $this->fetchUser($packet['u']);
- $this->users[$packet['u']]['cb'] = @$packet['cb'];
- $this->users[$packet['u']]['s'] = @$packet['s'];
- $this->users[$packet['u']]['f'] = (isset($packet['f'])) ? (int)$packet['f'] : 0;
- $this->users[$packet['u']]['id'] = $packet['u'];
- $this->users[$packet['u']]['d0'] = (isset($packet['d0'])) ? (int)$packet['d0'] : 0;
- $this->users[$packet['u']]['d2'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
- $this->users[$packet['u']]['q'] = (isset($packet['q'])) ? (int)$packet['q'] : 0;
- $this->users[$packet['u']]['registered'] = ((key_exists('N',$packet))?$packet['N']:'Unregistered');
- //$this->users[$packet['u']]['name'] = (substr(@$packet['n'],0,1)=="$") ? substr(@$packet['n'],0,1) : $packet['n'];
- $this->users[$packet['u']]['name'] = @$packet['n'];
- $this->users[$packet['u']]['avatar'] = (isset($packet['a'])) ? @$packet['a'] : 'No Avatar';
- $this->users[$packet['u']]['home'] = (isset($packet['h'])) ? @$packet['h'] : 'No Homepage';
- $this->users[$packet['u']]['v'] = (@$packet['v']) ? @$packet['v'] : 0;
- $this->users[$packet['u']]['bride'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
- $this->users[$packet['u']]['rel'] = (@$packet['d0'] & 1) ? 1 : 2;//Relationship Type: 1=BFF 2=Married #note that if they not in a relationship it will show there Married this can be fixed by detecting if they have a bride [D2]
- $this->users[$packet['u']]['sub'] = (isset($packet['p0'])) ? 1 : 0;
- if($this->autoWelcome!=''&&!isset($packet['s']))$this->sendPM($packet['u'], $this->autoWelcome);
- if($packet['rank'] == 5)
- {
- if($this->automember){
- $this->member($packet['u']);
- }
- }
- if($packet['rank'] == 3)
- {
- if($this->autoguest){
- $this->guest($packet['u']);
- }
- }
- break;
- case'i':
- $info = explode(';=', $this->packet['i']['b']);
- $this->radioinfo = str_replace("http://", "", $info[4]);
- $ci = explode(';=', $packet['b']);
- $this->chatInfo = array('background'=>$ci[0], 'tabbedChat'=>$ci[1],'tabbedChatID'=>$ci[2],'language'=>$ci[3],'radio'=>str_replace('http://','',$ci
- [4]),'buttons'=>$ci[5]);
- print_r($this->chatInfo);
- break;
- case "z":
- $this->enviarMSG( "Don't click me :( !", "PM", $packet[ "u" ] );
- break;
- case "m": // Use For Add Questions and Answers
- if(isset($this->packet['m']['s'])) return;
- if(($this->packet['m']['t']) =='Assalam o Alaikum') {
- $user = $this->users[ $packet[ "u" ] ];
- $user2 = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Walikum Assalam ['.$user2.'] ');
- }
- if(($this->packet['m']['t']) =='bot mar ja') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Tujha mar kar maro ga (bite#c#angry) ');
- }
- if(($this->packet['m']['t']) =='assalam o alaikum') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Walikum Assalam '.$user.' ');
- }
- if(($this->packet['m']['t']) =='salam') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Walikum Assalam '.$user.'');
- }
- if(($this->packet['m']['t']) =='andre') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('yeah i know andre is realy nice person (redface) ');
- }
- if(($this->packet['m']['t']) =='lazy bot') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('i am not lazy ok (backoff) ');
- }
- if(($this->packet['m']['t']) =='brb') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Go to Fast and come back fast(rapid)');
- }
- if(($this->packet['m']['t']) =='hi') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Hi ['.$user.'] (hug)');
- }
- if(($this->packet['m']['t']) =='hi bot') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Bye '.$user.' (bye)');
- }
- if(($this->packet['m']['t']) =='xd') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('(xp#hehe) ['.$user.'] ');
- }
- if(($this->packet['m']['t']) =='how are you?') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('well thank you very much! (jolly) ['.$user.'] ');
- }
- if(($this->packet['m']['t']) =='bot') {
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('Bot is your mother i am boss (un) ');
- }
- case "p":
- if($this->censor($packet['t'])) {
- //$this->send('<c p="This word is not allowed here . (D)" u="'.$packet['u'].'" t="/k" />');
- $this->kick('This word is not allowed here.(d)',$packet['u']);
- }
- If ( isset( $packet[ "i" ] ) && $packet[ "i" ] > 0 )
- break;
- $msg = $mensagem = explode( " ", $packet[ "t" ] );
- unset( $msg[ 0 ] );
- $msg = implode( " ", $msg );
- If ( isset( $mensagem[ 0 ] ) && $mensagem[ 0 ][ 0 ] != "!" )
- break;
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "N" ] ) ? $user[ "N" ] : $user[ "u" ];
- switch ( substr( $mensagem[ 0 ], 1 ) ) {
- /* Weoxo Bot Commands for all */
- case "say":
- // !say [msg]
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG ('['.$user.'] '.$msg);
- break;
- case "test":
- // !test [msg]
- $user = $this->users[ $packet[ "u" ] ];
- $user = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->enviarMSG (' ('.$msg.')');
- break;
- case "info":
- // !info
- $this->enviarMSG( "Weoxo Bot System for weoxo.com (created by Devil)!", "PM", $packet[ "u" ] );
- break;
- case'smiles':
- mysql_connect('localhost','root','kinghacker');
- mysql_select_db('weoxo') or $this->sendMesage('Can\'t connect.');
- $message = explode(' ', $mensagem[1], 1);
- $power = $message[0];
- $db = mysql_query("SELECT * FROM `powers` WHERE name='$power'");
- $row = mysql_fetch_array($db);
- if(!$row['name']) {$this->enviarMSG('Power not found! (d)');}
- else {
- $powers = str_replace(',','#)(',$row['topsh']);
- if(empty($row['topsh'])) {$this->enviarMSG(ucfirst($power).' has only ('.$power.') as smilies.');}
- else {
- $this->enviarMSG('('.$power.'#) Smilies : ('.$powers.'#)');}}
- break;
- case'dunceme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'. $packet['u'] .'" t="/gd3600" />');
- break;
- case'snakeme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="134" p="You have been snaked by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unsnaked." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'spaceme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="136" p="You have been spaced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unspaced." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'matchme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="140" p="You have been match by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unmatch." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'mazeme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="152" p="You have been mazed by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unmazed." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'codeme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="162" p="You have been coded by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are uncoded." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'reverseme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="176" p="You have been reverse by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unreversed." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'zipme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="184" p="You have been zip by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unzip." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'soltme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="236" p="You have been solt by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unsolt." u="'. $packet['u'] .'" t="/g3600" />');
- break;
- case'zapme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="121" p="You have been zapped by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unzapped. #screamman#bump" u="'. $packet['u'] .'" t="/k" />');
- break;
- case'gagme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c w="41" p="You have been gagged by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are ungagged." u="'. $packet['u'] .'" t="/gg3600" />');
- break;
- case'naughtyme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c p="You have been naughty by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unnaughty." u="'. $packet['u'] .'" t="/gn3600" />');
- break;
- case'yellowme':
- $message = explode(' ', $mensagem[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->enviar('<c p="You have been yellow by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unyellow." u="'. $packet['u'] .'" t="/gy3600" />');
- break;
- case 'id':
- $id = file_get_contents('http://weoxo.com/web_gear/chat/auser3.php');
- if(!$id) { return $this->enviarMSG('unable to connect!',($type==0)?1:$type,$packet['u']); }
- //$id = str_replace($id, '=', ' = ');
- $t = explode('&',$id);
- $id = array('id'=>$t[1], 'k1'=>$t[2], 'k2'=>$t[3]);
- $link = 'http://xat.com/web_gear/chat/register.php?'.$id['id'].'&'.$id['k1'].'&'.$id['k2'].'&mode=1';
- $this->enviarMSG(implode(', ',$id),($type==0)?1:$type,$packet['u']);
- $this->enviarMSG($link,($type==0)?1:$type,$packet['u']);
- break;
- case 'radio':
- $connection = explode(':', $this->radioinfo);
- $url = fsockopen($connection[0],$connection[1]);
- if($this->radioinfo == 'semnome' or !$this->radioinfo){$this->enviarMSG("This group chat does not have a radio.");
- return false;}
- if(!$url){
- $this->enviarMSG("Connection failed."); return false;
- } else {
- fputs($url,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
- $socket = fread($url, 1000);
- $return = explode(",", $socket);
- $final = str_replace("</body></html>", "", $return[6]);
- if(!$final){
- $this->enviarMSG("The current song on the radio is: nameless."); return false;
- } else
- $this->enviarMSG("The current song on the radio is: {$final}");
- }
- break;
- case 'youtube':
- case '11':
- $query = str_replace('Â ', '%20', $msg);
- $x = file_get_contents('http://gdata.youtube.com/feeds/api/videos?max-results=3&q=' . str_replace(' ', '%20', urlencode($query)));
- $js = json_decode(json_encode(new SimpleXMLElement($x)));
- if (!isset($js->entry[0]->title))
- return $this->enviarMSG('No results from Youtube.', $type, $msg['u']);
- $videos = array();
- $i = 0;
- while ($i != 3) {
- $URL = get_object_vars($js->entry[$i]->link[0]);
- $link = explode('&', $URL['@attributes']->href);
- if (!empty($link[0]))
- $this->enviarMSG($js->entry[$i]->title . ' - ' . $link[0], $type, $msg['u']);
- $i++;
- sleep(3);
- }
- break;
- case'typing':
- switch(strtolower($mensagem[1])){
- case 'on':
- $this->enviar('/RTypeOn');
- break;
- case 'off':
- $this->enviar('/RTypeOff');
- break;
- }
- break;
- case'price1':
- $message = explode(' ', $mensagem[1], 1);
- $powers = $message[0];
- mysql_connect('localhost','root','kinghacker');
- mysql_select_db('weoxo');
- if(is_numeric($powers)){
- $db = mysql_query("SELECT * FROM `powers` WHERE id ='$powers'");}
- else {$db = mysql_query("SELECT * FROM `powers` WHERE name ='$powers'");}
- $row = mysql_fetch_array($db);
- if($row['name'] == true) {
- if(empty($row['xats'])) {$row['xats'] = '0 - 0';}
- if(empty($row['days'])) {$row['days'] = '0 - 0';}
- $this->enviarMSG(htmlentities(ucfirst($row['name'])).' Cost '.$row['xats'].' Coins or '.$row['days'].' days.');
- } else { $this->enviarMSG('Power not found.');}
- break;
- case'rinfo':
- $this->enviarMSG('ID : '.$this->chat.' | Buttons : _'.$this->chatInfo['buttons'].' | Radio : '.$this->chatInfo['radio'].' | Background : '.$this->chatInfo['background']);
- break;
- case "cmd":
- // !info
- $this->enviarMSG( "!online , !say , !price , !love , !choose , !perg , !info ,
- mazeme,snakeme,!att", "PM", $packet[ "u" ] );
- break;
- case 'online':
- $this->enviarMSG( $users . '' . 'There ' . count( $this->users ) . ' Users Online.' );
- break;
- case "choose":
- // !choose [coisa] [coisa2]
- $mensagem = explode( ' ou ', strtolower( $msg ) );
- if ( !isset( $mensagem[ 0 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
- return $this->enviarMSG( 'It takes two choice (D)', "PM", $packet[ 'u' ] );
- $mensagem = array_values( $mensagem );
- $rand = $mensagem[ array_rand( $mensagem ) ];
- $this->enviarMSG( 'I prefer ' . $rand, "PM", $packet[ 'u' ] );
- break;
- case "perg":
- case "8ball":
- // !perg/!8ball [pergunta]
- $respostas = array(
- 'Maybe',
- 'Sim.',
- 'Do Not.',
- 'My sources said no.',
- 'Ah, SIM and SIM',
- 'In fact I do not know',
- 'Outlook does not provide \'-\'',
- 'I think not',
- 'Very good',
- 'It was determined that yes.'
- );
- $resposta = $respostas[ array_rand( $respostas ) ];
- $mensagens = array( );
- foreach ( $mensagens as $k => $valor ) {
- $valor2 = strtoupper( $valor );
- array_push( $mensagens, $valor2 );
- } //$mensagens as $k => $valor
- $this->enviarMSG( ' [' . $user . ']' . $resposta, "PM", $packet[ 'u' ] );
- break;
- case 'lovetest':
- // !lovetest [alguma coisa] [alguma coisa2]
- $gerar = rand( 0, 100 );
- $this->enviarMSG( $mensagem[ 1 ] . ' + ' . $mensagem[ 2 ] . ' = ' . $gerar . '%' );
- break;
- /* Commands for admins */
- case "restart":
- // !restart
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $this->enviarMSG( "[Server]: I'm being restarted (backoff)" );
- $this->reiniciar();
- $this->entrar();
- break;
- case'userinfo':
- $message = explode(' ', $mensagem[1], 1);
- $user = $message[0];
- if(!$this->users[$user]['id']){ $this->enviarMSG('I Do not NOOB.');}
- else{
- if($this->users[$user]['rel'] == 2) $this->users[$user]['rel'] = "Married";
- if($this->users[$user]['rel'] == 1) $this->users[$user]['rel'] = "BFF";
- $myNick = explode("##", $this->users[$user]['name'], 2);
- $myNick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($myNick[0])));
- $relation = $this->users[$user]['rel'].' to '.$this->users[$user]['d2'];
- if($relation == 'Married to 0') $relation = 'Relation not found.';
- $name = explode('##', $this->users[$user]['name']);
- $n = $name[1];
- $this->enviarMSG('Name : '.$myNick[0].' | Status : '.str_replace('#',' | ',$n).'| Avatar : '.$this->users[$user]['avatar'].' | Home : '.$this->users[$user]['home'].' | Relation : '.$relation);
- }
- break;
- case "desligar":
- case "die":
- // !die
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $this->enviarMSG( "[Server]: I'm shutting down (bye)" );
- die( );
- break;
- case "time":
- $s = time() - $this->time;
- $m = floor($s / 60);
- $h = floor($m / 60);
- $msg = "Run time (approx): Seconds - $s | Minutes - $m | Hours - $h";
- $this->sendmsg($msg);
- break;
- case 'automember':
- // !automember [on/off]
- if ( !in_array( $packet[ 'u' ], $this->admins ) )
- {
- return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
- } //!in_array( $packet[ 'u' ], $this->admins )
- switch ( $mensagem[ 1 ] )
- {
- case 'on':
- $this->automember = True;
- $this->enviarMSG( 'The automember system was activated!' );
- break;
- case 'off':
- $this->automember = False;
- $this->enviarMSG( 'The automember system has been disabled!' );
- break;
- default:
- $this->enviarMSG( 'You should choose an option [on / off].' );
- } //$mensagem[ 1 ]
- break;
- case 'autoguest':
- // !automember [on/off]
- if ( !in_array( $packet[ 'u' ], $this->admins ) )
- {
- return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
- } //!in_array( $packet[ 'u' ], $this->admins )
- switch ( $mensagem[ 1 ] )
- {
- case 'on':
- $this->autoguest = True;
- $this->enviarMSG( 'The autoguest system was activated!' );
- break;
- case 'off':
- $this->autoguest = False;
- $this->enviarMSG( 'The autoguest system has been disabled!' );
- break;
- default:
- $this->enviarMSG( 'You should choose an option [on / off].' );
- } //$mensagem[ 1 ]
- break;
- case 'edit':
- // !edit name , status , glow , hat ,avatar
- if ( !in_array( $packet[ 'u' ], $this->admins ) )
- {
- return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
- } //!in_array( $packet[ 'u' ], $this->admins )
- switch ( $mensagem[ 1 ] )
- {
- case'name':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $this->name = $mensagem[ 2 ];
- $this->entrar();
- $this->enviarMSG('My name has been changed to : '.$this->name);
- break;
- case'status':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $this->status = htmlentities($mensagem[2]);
- $this->entrar();
- $this->enviarMSG('My status has been changed : '.$this->status );
- break;
- case'glow':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $mensagem = explode( ' ou ', strtolower( $msg ) );
- if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
- $this->glow = $mensagem[0];
- $this->entrar();
- $this->enviarMSG('My GlowColor has been changed to [ #'.$this->glow.' ]');
- break;
- case'hat':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $mensagem = explode( ' ou ', strtolower( $msg ) );
- if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
- $this->hat = $mensagem[0];
- $this->entrar();
- $this->enviarMSG('My hat was changed to Success : ' );
- break;
- case'home':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $mensagem = explode( ' ou ', strtolower( $msg ) );
- if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
- $this->home = $mensagem[0];
- $this->entrar();
- $this->enviarMSG('My little house has been changed : ' );
- break;
- case'welcome':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $mensagem = explode( ' ou ', strtolower( $msg ) );
- if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
- $this->autoWelcome = $mensagem[0];
- $this->entrar();
- $this->enviarMSG('My Welcome message has changed for : '.$this->autoWelcome );
- break;
- default:
- $this->enviarMSG( 'You should choose an option : !edit [name , status , glow , hat ,avatar].' );
- } //$mensagem[ 1 ]
- break;
- /* Command Admin for Bot Created Juninho & Sloom! */
- case "staff":
- // !staff
- $this->enviarMSG( " 1 , 4 , 7 , 2M , 1802 , 69 ", "PM", $packet[ "u" ] );
- break;
- case'avatar':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- $this->avatar = $mensagem[1];
- $this->avatar = str_replace(' (', '(', $this->avatar);
- $this->avatar = str_replace(') ', ')', $this->avatar);
- $this->avatar = str_replace(' ', ' ', $this->avatar);
- $this->entrar();
- $this->entrar();
- $this->enviarMSG('My avatar has been changed : '.$this->avatar );
- break;
- case'last':
- $pow2 = file_get_contents('http://xat.com/web_gear/chat/pow2.php?Milk=1234');
- $pow2 = json_decode($pow2, true);
- $powername = array_search($pow2['0']['1']['id'], $pow2['5']['1']);
- $status = ($pow2[0][1]['text'] == '[LIMITED]') ? 'LIMITED':'UNLIMITED';
- $smilie = array_merge(array($powername), array_keys($pow2['3']['1'], $pow2['0']['1']['id'])); //get all smilies of the new power
- $smilies = array();
- $pawns = array();
- foreach($smilie as $v)
- array_push($smilies, $v);
- foreach($pow2[6][1] as $name => $value)
- if($name != 'time' && $value[0] == $pow2['0']['1']['id'])
- array_push($pawns, 'h'.$name);
- $smilielist = implode(", ", $smilies);
- $pawnlist = implode(", ", $pawns);
- $this->enviarMSG(ucfirst($powername).' | ID : '.$pow2['0']['1']['id'].' | Status : '.$status.' | Smilies: '.ucfirst($smilielist).' | Hats : '.$pawnlist);
- break;
- case 'calc':
- /* Command created by iZerang */
- // !calc [numero] [/ * * -] [numero 2]
- if ( is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] ) ) {
- switch ( $mensagem[2] ) {
- case "*":
- $x = $mensagem[1] * $mensagem[3];
- $this->enviarMSG("{$mensagem[1]} x {$mensagem[3]} = {$x}");
- break;
- case "/":
- $x = $mensagem[1] / $mensagem[3];
- $this->enviarMSG("{$mensagem[1]} + {$mensagem[3]} = {$x}");
- break;
- case "+":
- $x = $mensagem[1] + $mensagem[3];
- $this->enviarMSG("{$mensagem[1]} + {$mensagem[3]} = {$x}");
- break;
- case "-":
- $x = $mensagem[1] - $mensagem[3];
- $this->enviarMSG("{$mensagem[1]} - {$mensagem[3]} = {$x}");
- break;
- }
- //$mensagem[2]
- } //is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] )
- else {
- $this->enviarMSG( 'You must enter a valid account' , "PM", $packet[ "u" ] );
- }
- break;
- case 'price':
- /* Command created by iZerang */
- $x1 = strtr(substr($mensagem[1], 0, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- $x2 = strtr(substr($mensagem[1], 1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
- $msg = $x1.$x2;
- if(empty($msg)){$this->enviarMSG('The power of the name can not be empty.'); return;}
- $url = @file_get_contents('http://xatalert.com/fairtrade/');
- file_put_contents($core->lib . "prices.txt", $pricelist);
- if(empty($msg)){$this->enviarMSG('Failed to get price notify an administrator!'); return;}
- $parte1 = explode($msg.'</abbr></td><td></td><td>(', $url);
- $final = explode(')</td><td>',$parte1[1]);
- if(!$final[0]){
- $parte1 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>(', $url);
- $final = explode(')</td><td>',$parte1[1]);
- }
- $parte2 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>', $url);
- $final2 = explode('</td><td>',$parte2[1]);
- if(!$final2[0]){
- $parte2 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>', $url);
- $final2 = explode('</td><td>',$parte2[1]);
- }
- $parte3 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
- $final3 = explode('</td><td>',$parte3[1]);
- if(!$final3[0]){
- $parte3 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
- $final3 = explode('</td><td>',$parte3[1]);
- }
- if(!$final[0]){$this->enviarMSG('Power nonexistent, or not added yet.');}else
- $this->enviarMSG('The power in the '.$msg.' store costs: '.$final[0].', trade: '.$final2[0].', in days: '.$final3[0].'.');
- break;
- case 'dx':
- $days = intval($message[1]);
- if($days < 1)
- return $this->sendPM($packet['u'], 'days must be 1 or more');
- $tradeValue = 13;
- $xats = floor($days * $tradeValue);
- $this->enviarMSG($days.' days equals '.$xats.' xats');
- break;
- case 'xclear11111111111111':
- If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
- return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
- } //!in_Array( $packet[ "u" ], $this->admins )
- return $this->enviarMSG('Sorry, but you are not allowed to do so!');;
- $this->clear = $mensagem[1];
- case 'msg11111111111111':
- case 'chat11111111111':
- case 'messages1111111111111':
- case 'message1111111111111111':
- $this->clearMsg(true,25);
- $this->socket->connect();
- $this->network->join();
- break;
- } //substr( $mensagem[ 0 ], 1 )
- } //$tipo
- }
- /* Reiniciar o servidor */
- public function reiniciar( )
- {
- $this->conectar();
- $this->entrar();
- }
- public function fetchUser($id) {
- $id = $this->parseU($id);
- if(isset($this->users[$id]))
- return $this->users[$id];
- else
- return false;
- }
- function kick($message, $id, $log=true) {
- if($log) {
- if(!empty($this->users[$id]['kicks']) ) $this->users[$id]['kicks']++;
- else $this->users[$id]['kicks'] = 1;
- }
- if($this->users[$id]['kicks'] > $this->maxKicks) {
- $this->ban($message,$id,3600);
- $this->users[$id]['kicks'] = 0;
- return;
- }
- $this->enviar('<c p="'.$message." ".$this->users[$id]['kicks'].'/'.$this->maxKicks.'" u="'.$id.'" t="/k" />');
- }
- function ban($message, $id, $time) {
- $this->enviar('<c p="'.ereg_replace('[^A-Za-z0-9.! ]','',$message).'" u="'.$id.'" t="/g'.$time.'" />');
- }
- public function sendPM($id=0, $packet='') {
- $id = $this->parseU($id);
- $this->enviar('<p u="'.$id.'" t="'.$packet.'" d="'.$id.'" />');
- }
- public function parseU($id) {
- if(strpos($id, "_") > -1)
- $e = explode("_", $id);
- $u = (strpos($id, "_") > -1) ? $e[0] : $id;
- return $u;
- }
- function member($id,$time=null) {
- if(!$time) $time = 0;
- $id = $this->parseU($id);
- $this->sendC($id, '/e',$time);
- }
- function guest($id,$time=null) {
- if(!$time) $time = 0;
- $id = $this->parseU($id);
- $this->sendC($id, '/r',$time);
- }
- public function sendC($id=0, $com='') {//Shit always comes in handy after awhile.
- $this->enviar('<c u="'.$id.'" t="'.$com.'" />');
- }
- public function censor($message) {
- $badwords = $this->censor;
- $message = @preg_replace('#\((.+)\)#U','',strtolower(' '.$message.' '));
- foreach($badwords as $bad) {
- $bad = trim($bad);
- if(strpos($message.' ', $bad.' ')!==false) {
- if(strlen($bad)>=2) {
- return true;
- }
- }
- }
- }
- /* Enviar MSG, definido com tipo e ID */
- function enviarMSG( $mensagem, $tipo = "MSG", $id = 0 )
- {
- If ( !$mensagem ) {
- return False;
- } //!$mensagem
- switch ( $tipo ) {
- case "MSG": // Sample
- $this->enviar( "<m t=\"{$mensagem}\" u=\"{$this->botID}\" />" );
- break;
- case "PM": // PM
- $this->enviar( "<p u=\"{$id}\" t=\"{$mensagem}\" d=\"{$id}\" />" );
- break;
- case "PC": // Privado
- $this->enviar( "<z d=\"{$id}\" u=\"{$this->botID}\" t=\"{$mensagem}\" />" );
- break;
- } //$tipo
- }
- }
- $bot = new zBot(); // Estanciar a class
- while ( 1 ) {
- try {
- If ( $bot->load() == "OFF" ) {
- $bot->desconectar();
- $bot->entrar();
- } //$bot->load() == "OFF"
- }
- catch ( Exception $e ) {
- die( $e );
- }
- } //1
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement