Esempio n. 1
0
 function onChannelMessage()
 {
     if (libString::startsWith("!seen", $this->data['text'])) {
         return;
     }
     $this->saveVar($this->User->id, array('action' => 'PRIVMSG', 'server' => $this->Server->host, 'channel' => $this->Channel->name, 'nick' => $this->User->nick, 'text' => $this->data['text'], 'time' => $this->Bot->time));
 }
Esempio n. 2
0
 function getStats($username, $html)
 {
     if (libString::startsWith('::', $html)) {
         return false;
     }
     $tmp = explode(':', $html);
     $data = array('username' => $username, 'rank' => $tmp[0], 'challs_solved' => $tmp[1], 'challs_total' => $tmp[2], 'users_total' => $tmp[3]);
     return $data;
 }
Esempio n. 3
0
 function getStats($username, $html)
 {
     if (libString::startsWith('This user doesn\'t exist!', $html)) {
         return false;
     }
     preg_match('/^(.+?) has solved (\\d+) out of (\\d+) challenges.(?: He is at position (\\d+?) out of (\\d+)!)?$/', $html, $arr);
     $data = array('username' => $arr[1], 'challs_solved' => $arr[2], 'challs_total' => $arr[3], 'rank' => isset($arr[4]) ? $arr[4] : false, 'users_total' => isset($arr[5]) ? $arr[5] : false);
     if (!$data['rank']) {
         $this->statsText = '{username} solved {challs_solved} (of {challs_total}) challenges. There is no information available about his/her rank at {url}';
     }
     return $data;
 }
Esempio n. 4
0
 function getStats($username, $html)
 {
     $HTTP = new HTTP('www.wechall.net');
     $html = $HTTP->GET('/wechallchalls.php?username='******'timeout';
     }
     if (libString::startsWith('The user', $html)) {
         return false;
     }
     preg_match('/^(.+?) solved (\\d+?) of (\\d+?) Challenges with (\\d+?) of (\\d+?) possible points \\(([\\d\\.]+?)%\\). Rank for the site WeChall: (\\d+)$/', $html, $arr);
     $html = $HTTP->GET('/wechall.php?username=noother');
     if ($html === false) {
         return 'timeout';
     }
     preg_match('/is ranked \\d+? from (\\d+),/', $html, $arr2);
     $data = array('username' => $arr[1], 'challs_solved' => $arr[2], 'challs_total' => $arr[3], 'points' => $arr[4], 'points_total' => $arr[5], 'points_percent' => $arr[6], 'rank' => $arr[7], 'users_total' => $arr2[1]);
     return $data;
 }
Esempio n. 5
0
 public final function onPrivmsg()
 {
     $this->onMessage();
     $isQuery = $this->data['isQuery'];
     unset($this->data['isQuery']);
     if ($isQuery) {
         $this->onQuery();
     } else {
         $this->onChannelMessage();
     }
     $this->data['isQuery'] = $isQuery;
     foreach ($this->triggers as $trigger) {
         $trigger_len = strlen($trigger);
         if (libString::startsWith($trigger, $this->data['text'])) {
             if ($trigger_len == strlen($this->data['text'])) {
                 $this->data['trigger'] = $trigger;
                 unset($this->data['text']);
                 $this->isTriggered();
                 break;
             } elseif ($this->data['text'][$trigger_len] == ' ') {
                 $this->data['trigger'] = $trigger;
                 $this->data['text'] = substr($this->data['text'], $trigger_len + 1);
                 $this->isTriggered();
                 break;
             }
         }
     }
 }