Assembla home | Assembla project page
 

root/trunk/Phergie/Plugin/Daddy.php

Revision 223, 0.9 kB (checked in by Slynderdale, 6 months ago)

Various bug fixes and enhancements:

Notable Changes:

  • Bot.php: The auto loader now strips out the "Phergie_" prefix from class names while getting the path to the class file to include for those who don't have the bot in a directory called Phergie. Both the Phergie directory and the parent directory were added to the include path. Also added a check to see if they have a timezone is set in PHP.ini, if not, set the timezone to the default timezone to prevent strict errors while using date.
  • Streams.php: Added support for invite requests and also fixed a small bug where an empty command gets ent to call_user_func due to a packet getting cut off.
  • Base.php: Added onInvite and changed fromAdmin so the first argunent needs to be set to true for hostmask admin checking.
  • Lart.php: Improved lart a bit and fixed bugs where you couldn't remove certain terms due to spacing/character casing issues
  • Seen.php: Added a quote command to get a random quote by a specified user
  • Users.php: Renamed Users to ServerInfo to prepare it for future changes to make it store more information about users, channels and the server. Also fixed a bug where halfops and voiced users were considered an OP.
Line 
1 <?php
2
3 /**
4  * Simply responds to messages addressed to the bot that contain the phrase
5  * "Who's your daddy?"
6  */
7 class Phergie_Plugin_Daddy extends Phergie_Plugin_Abstract_Base
8 {
9     /**
10      * Checks messages for the question to which it should respond and sends a
11      * response when appropriate
12      *
13      * @return void
14      */
15     public function onPrivmsg()
16     {
17         $bot = $this->getIni('nick');
18         $text = $this->event->getArgument(1);
19         $target = $this->event->getNick();
20         if (preg_match('/' . preg_quote($bot) . '\s*[:,>]?\s+?who\'?s y(?:our|a) ([^?]+)\??/iAD', $text, $m)) {
21             if ($this->getIni('curses') && mt_rand(0, 5) === 5) {
22                 $this->doPrivmsg($this->event->getSource(), $target . ': I am your ' . $m[1] . ', bitch!');
23             } else {
24                 $this->doPrivmsg($this->event->getSource(), 'You\'re my ' . $m[1] . ', ' . $target . '!');
25             }
26         }
27     }
28 }
29
Note: See TracBrowser for help on using the browser.