root/trunk/Phergie/Plugin/Daddy.php @ 72

Revision 72, 0.9 KB (checked in by Seldaek, 5 years ago)

* Acronym : allowed <Nick>: ACRO?
* Daddy : added "I am your daddy, bitch!" 10% chance response (if curses is on)
* Logging : fixed "heard foo bar" triggering false positive heard answers, same for seen
* Url : caches 5 URLs now to avoid cross-bot flood
* phergie.ini : added global curses switch

Line 
1<?php
2
3/**
4* @see Phergie_Plugin_Abstract_Base
5*/
6require_once 'Phergie/Plugin/Abstract/Base.php';
7
8/**
9* Simply responds to messages addressed to the bot that contain the phrase
10* "Who's your daddy?"
11*/
12class Phergie_Plugin_Daddy extends Phergie_Plugin_Abstract_Base
13{
14    /**
15    * Checks messages for the question to which it should respond and sends a
16    * response when appropriate
17    *
18    * @return void
19    */
20    public function onPrivmsg()
21    {
22        $bot = $this->getIni('nick');
23        $text = $this->event->getArgument(1);
24        if (preg_match('/' . $bot . '\s*:?\s+?who\'?s your daddy\??/iAD', $text)) {
25            if($this->getIni('curses') === 'true' && rand(0,10) === 10) {
26                $this->doPrivmsg($this->event->getSource(), $this->event->getNick() . ': I am your daddy, bitch!');
27            } else {
28                $this->doPrivmsg($this->event->getSource(), 'You\'re my daddy, ' . $this->event->getNick() . '!');
29            }
30        }
31    }
32}
Note: See TracBrowser for help on using the browser.