Assembla home | Assembla project page
 

Changeset 152

Show
Ignore:
Timestamp:
03/09/08 19:01:31 (9 months ago)
Author:
Slynderdale
Message:

A small bugfix so it doesn't spew chucknorris facts when chuck norris is prefixed with the bots name.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/ChuckNorris.php

    r144 r152  
    241241        // Check to see if the message includes the word Chuck Norris. If so, check to see if 
    242242        // it was a bot request by checking for Fact: at the begiining and also do a floodpro check 
    243         if (preg_match('{(chuck\s*norris)}i', $message, $m) && 
     243        if (!preg_match('{^(?:' . $this->getIni('nick') . '\s*:?\s+)}i', $message, $m) && 
     244            preg_match('{(chuck\s*norris)}i', $message, $m) && 
    244245            strtolower(substr($message, 0, 5)) != 'fact:' && 
    245246            ($this->floodCheck <= 0 || ($this->floodCache[$source] < (time() - $this->floodCheck)))) { 
     
    250251                 $this->doPrivmsg($source, 'Fact: '.$fact); 
    251252                 $this->floodCache[$source] = time(); 
    252                  unset($fact); 
     253                 unset($m, $fact); 
    253254            } 
    254255        }