Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Chat/irc_bot.php

    r738 r873  
    3030  function Say($Message, $Recipient = '')
    3131  {
    32     if($Recipient == '') $Recipient = $this->Channel;
     32    if ($Recipient == '') $Recipient = $this->Channel;
    3333    $this->Command(': PRIVMSG '.$Recipient.' :'.$Message);
    3434  }
     
    4343    global $Database;
    4444
    45     while(!fwrite($this->File, ''))
     45    while (!fwrite($this->File, ''))
    4646    {
    4747      $this->Command('JOIN '.$this->Channel);
     
    5151
    5252      $LineParts = explode(' ', $Line);
    53       if(count($LineParts) > 0)
     53      if (count($LineParts) > 0)
    5454      {
    55         if($LineParts[0] == 'PING')
     55        if ($LineParts[0] == 'PING')
    5656        {
    5757          $this->Command('PONG '.trim($LineParts[1])."\n");
     
    5959        }
    6060
    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) == ':#'))
    6464          {
    6565            $CurrentChannel = substr(trim($LineParts[3]), 1);
     
    7878
    7979      // Log messages to database
    80       if(strpos($Line, 'PRIVMSG') !== false)
     80      if (strpos($Line, 'PRIVMSG') !== false)
    8181      {
    8282        $Text = addslashes($Commands[2]);
     
    9191
    9292      explode(':', $Line);
    93       foreach($Commands as $Index => $Item)
     93      foreach ($Commands as $Index => $Item)
    9494        $Commands[$Index] = trim($Item);
    9595
    96       if(count($Commands) >= 2)
     96      if (count($Commands) >= 2)
    9797      {
    9898        $Command = $Commands[2];
    9999
    100100        // Jméno - Pošle vizitku
    101         if($Command == $this->Nick)
     101        if ($Command == $this->Nick)
    102102        {
    103103          $this->Say('Ahoj lidi, ja jsem '.$this->OwnerName.' bot. Random#: '.rand(0, 10));
     
    106106
    107107        // hhelp - vypise tuto napovedu
    108         if($Command == 'hhelp')
     108        if ($Command == 'hhelp')
    109109        {
    110110          $this->Say('Ja jsem Harvester.');
     
    124124
    125125        // hsay:Message - Posle zpravu
    126         if($Command == 'hsay')
     126        if ($Command == 'hsay')
    127127        {
    128128          $this->Say($Commands[3]);
     
    131131
    132132        // hpsay:to:Message - Posle soukromou zpravu kanalu nebo osobe
    133         if($Command == 'hpsay')
     133        if ($Command == 'hpsay')
    134134        {
    135135          $this->Say($Commands[4], $Commands[3]);
     
    138138
    139139        // hcol:to:Message - Posle kolizni zpravu kanalu nebo osobe
    140         if($Command == 'hcol')
     140        if ($Command == 'hcol')
    141141        {
    142142          $this->Say($Commands[4], $Commands[3]);
     
    145145
    146146        // hdo:Command - Posle serveru prikaz
    147         if($Command == 'hdo')
     147        if ($Command == 'hdo')
    148148        {
    149149          $hdo = explode('hdo:', $Line);
     
    153153
    154154        // hpart:Channel - Odpoji se z kanalu
    155         if($Command == 'hpart')
     155        if ($Command == 'hpart')
    156156        {
    157157          $hdo = explode('hpart:', $Line);
    158           if(trim($hdo[1]) != trim($this->Channel))
     158          if (trim($hdo[1]) != trim($this->Channel))
    159159          {
    160160            $this->Command('PART :'.trim($hdo[1])."\n");
     
    164164
    165165        // hmove:Channel - Zmeni aktivni kanal
    166         if($Command == 'hmove')
     166        if ($Command == 'hmove')
    167167        {
    168168          $hdo = explode("hmove:", $Line);
    169           if(trim($hdo[1]) != trim($$this->Cannel))
     169          if (trim($hdo[1]) != trim($$this->Cannel))
    170170          {
    171171            $this->Channel = trim($hdo[1]);
     
    177177
    178178        // htime - udaje o casu
    179         if($Command == 'htime')
     179        if ($Command == 'htime')
    180180        {
    181181          $Date = implode("-", getdate(time()));
     
    185185
    186186        // hjoke - Posle nahodny vtip
    187         if($Command == 'hjoke')
     187        if ($Command == 'hjoke')
    188188        {
    189189          $Joke = ($this->Jokes[rand(0, (sizeof($this->Jokes) - 1))]);
Note: See TracChangeset for help on using the changeset viewer.