2 class {$_NAME} extends Bot {
5 private $topic = false;
7 public function load($uplink, $old = false) {
8 $this->uplink = $uplink;
12 $host = "Services.NextIRC.net";
14 $realname = "QuoteBot";
16 $this->quote = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname);
17 if(is_a($this->quote, "P10_User")) {
18 $this->uplink->join($this->quote, "#lobby", P10_Channel::USERPRIV_OPED);
24 ModCMD::bind($this, BIND_CHANMSG, "recive_privmsg");
25 ModCMD::bind($this, BIND_QUIT, "recive_quit");
28 public function unload($rehash = false) {
32 $this->uplink->delUser($this->quote, "Bye.");
36 public function loop() {
40 public function recive_privmsg($user, $channel, $message) {
41 $exp=explode(" ", $message, 3);
42 switch (strtolower($exp[0])) {
44 $quelltext = file_get_contents('http://german-bash.org/action/random');
45 preg_match('#<span class="id">(.*?)</span>#is', $quelltext, $t);
46 preg_match('#<a(.*?)>(.*?)</a>#is', $t[1], $z);
47 preg_match('#<div class="zitat">(.*?)</div>#is', $quelltext, $m);
48 $string = nl2br(strip_tags($m[1]));
49 $array = explode("<br />", $string);
50 $length = count($array)-1;
51 $url = file_get_contents('http://tinyurl.com/api-create.php?url=http://german-bash.org/index.php?action=show&id='.str_replace('#', '', $z[2]));
53 foreach($array AS $index=>$value) {
54 $array[$index] = trim($value);
56 $this->uplink->privmsg($this->quote, $channel, "
\ 2\ 39Zitatnummer:
\ 2\ 30 ".$z[2]." ".$url);
57 for($i = 1; $i <= $length; $i++) {
58 if($array[$i] != '' && $array[$i] != '<br />') {
59 $this->uplink->privmsg($this->quote, $channel, html_entity_decode($array[$i]));
64 $doc = new DOMDocument();
65 @$doc->loadHTMLFile("http://mobil.ibash.de/zitate.php?order=random");
66 $tags = $doc->getElementsByTagName('code');
67 $codes = $tags->item($id)->childNodes;
70 for ($i = 1; $i < $codes->length; $i++)
72 //$text = utf8_decode(htmlspecialchars($codes->item($i)->nodeValue));
73 $text = utf8_decode($codes->item($i)->nodeValue);
76 $bash = str_replace(" ", " ", $bash);
77 $bash = explode("\n", $bash);
78 #sendserv("PRIVMSG $e[2] :\002iBashDE\002");
79 $this->uplink->privmsg($this->quote, $channel, "\002iBashDE\002");
82 #$this->uplink->privmsg($this->quote, $channel, print_r($bash));
83 foreach($bash as $line) {
86 $line = str_replace("<", "<", $line);
87 $line = str_replace(">", ">", $line);
88 $line = str_replace(""", '"', $line);
89 #sendserv("PRIVMSG $e[2] :".$line);
91 $this->uplink->privmsg($this->quote, $channel, $line);
99 public function recive_quit($user, $reason) {
100 if($user === $this->quote) {
101 $this->load($this->uplink);