root/trunk/Phergie/Plugin/Daddy.php
@
68
| Revision 68, 0.7 KB (checked in by tobias382, 5 years ago) |
|---|
| Rev | Line | |
|---|---|---|
| [19] | 1 | <?php |
| 2 | ||
| 3 | /** | |
| [68] | 4 | * @see Phergie_Plugin_Abstract_Base |
| [19] | 5 | */ |
| [68] | 6 | require_once 'Phergie/Plugin/Abstract/Base.php'; |
| [19] | 7 | |
| [59] | 8 | /** |
| 9 | * Simply responds to messages addressed to the bot that contain the phrase | |
| 10 | * "Who's your daddy?" | |
| 11 | */ | |
| [68] | 12 | class Phergie_Plugin_Daddy extends Phergie_Plugin_Abstract_Base |
| [19] | 13 | { |
| [59] | 14 | /** |
| 15 | * Checks messages for the question to which it should respond and sends a | |
| 16 | * response when appropriate | |
| 17 | * | |
| 18 | * @return void | |
| 19 | */ | |
| [58] | 20 | public function onPrivmsg() |
| [19] | 21 | { |
| [59] | 22 | $bot = $this->getIni('nick'); |
| [58] | 23 | $text = $this->event->getArgument(1); |
| [60] | 24 | if (preg_match('/' . $bot . '\s*:?\s+?who\'?s your daddy\??/iAD', $text)) { |
| 25 | $this->doPrivmsg($this->event->getSource(), 'You\'re my daddy, ' . $this->event->getNick() . '!'); | |
| [19] | 26 | } |
| 27 | } | |
| 28 | } |
Note: See TracBrowser
for help on using the browser.