Changeset 873 for trunk/Modules/Chat/irc_bot.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Chat/irc_bot.php
r738 r873 30 30 function Say($Message, $Recipient = '') 31 31 { 32 if ($Recipient == '') $Recipient = $this->Channel;32 if ($Recipient == '') $Recipient = $this->Channel; 33 33 $this->Command(': PRIVMSG '.$Recipient.' :'.$Message); 34 34 } … … 43 43 global $Database; 44 44 45 while (!fwrite($this->File, ''))45 while (!fwrite($this->File, '')) 46 46 { 47 47 $this->Command('JOIN '.$this->Channel); … … 51 51 52 52 $LineParts = explode(' ', $Line); 53 if (count($LineParts) > 0)53 if (count($LineParts) > 0) 54 54 { 55 if ($LineParts[0] == 'PING')55 if ($LineParts[0] == 'PING') 56 56 { 57 57 $this->Command('PONG '.trim($LineParts[1])."\n"); … … 59 59 } 60 60 61 if (count($LineParts) > 1)62 { 63 if ((trim($LineParts[1]) == 'INVITE') && (substr(trim($LineParts[3]), 0, 2) == ':#'))61 if (count($LineParts) > 1) 62 { 63 if ((trim($LineParts[1]) == 'INVITE') && (substr(trim($LineParts[3]), 0, 2) == ':#')) 64 64 { 65 65 $CurrentChannel = substr(trim($LineParts[3]), 1); … … 78 78 79 79 // Log messages to database 80 if (strpos($Line, 'PRIVMSG') !== false)80 if (strpos($Line, 'PRIVMSG') !== false) 81 81 { 82 82 $Text = addslashes($Commands[2]); … … 91 91 92 92 explode(':', $Line); 93 foreach ($Commands as $Index => $Item)93 foreach ($Commands as $Index => $Item) 94 94 $Commands[$Index] = trim($Item); 95 95 96 if (count($Commands) >= 2)96 if (count($Commands) >= 2) 97 97 { 98 98 $Command = $Commands[2]; 99 99 100 100 // Jméno - Pošle vizitku 101 if ($Command == $this->Nick)101 if ($Command == $this->Nick) 102 102 { 103 103 $this->Say('Ahoj lidi, ja jsem '.$this->OwnerName.' bot. Random#: '.rand(0, 10)); … … 106 106 107 107 // hhelp - vypise tuto napovedu 108 if ($Command == 'hhelp')108 if ($Command == 'hhelp') 109 109 { 110 110 $this->Say('Ja jsem Harvester.'); … … 124 124 125 125 // hsay:Message - Posle zpravu 126 if ($Command == 'hsay')126 if ($Command == 'hsay') 127 127 { 128 128 $this->Say($Commands[3]); … … 131 131 132 132 // hpsay:to:Message - Posle soukromou zpravu kanalu nebo osobe 133 if ($Command == 'hpsay')133 if ($Command == 'hpsay') 134 134 { 135 135 $this->Say($Commands[4], $Commands[3]); … … 138 138 139 139 // hcol:to:Message - Posle kolizni zpravu kanalu nebo osobe 140 if ($Command == 'hcol')140 if ($Command == 'hcol') 141 141 { 142 142 $this->Say($Commands[4], $Commands[3]); … … 145 145 146 146 // hdo:Command - Posle serveru prikaz 147 if ($Command == 'hdo')147 if ($Command == 'hdo') 148 148 { 149 149 $hdo = explode('hdo:', $Line); … … 153 153 154 154 // hpart:Channel - Odpoji se z kanalu 155 if ($Command == 'hpart')155 if ($Command == 'hpart') 156 156 { 157 157 $hdo = explode('hpart:', $Line); 158 if (trim($hdo[1]) != trim($this->Channel))158 if (trim($hdo[1]) != trim($this->Channel)) 159 159 { 160 160 $this->Command('PART :'.trim($hdo[1])."\n"); … … 164 164 165 165 // hmove:Channel - Zmeni aktivni kanal 166 if ($Command == 'hmove')166 if ($Command == 'hmove') 167 167 { 168 168 $hdo = explode("hmove:", $Line); 169 if (trim($hdo[1]) != trim($$this->Cannel))169 if (trim($hdo[1]) != trim($$this->Cannel)) 170 170 { 171 171 $this->Channel = trim($hdo[1]); … … 177 177 178 178 // htime - udaje o casu 179 if ($Command == 'htime')179 if ($Command == 'htime') 180 180 { 181 181 $Date = implode("-", getdate(time())); … … 185 185 186 186 // hjoke - Posle nahodny vtip 187 if ($Command == 'hjoke')187 if ($Command == 'hjoke') 188 188 { 189 189 $Joke = ($this->Jokes[rand(0, (sizeof($this->Jokes) - 1))]);
Note:
See TracChangeset
for help on using the changeset viewer.