root/trunk/Phergie/Plugin/Say.php @ 59

Revision 59, 0.7 KB (checked in by tobias382, 5 years ago)

Unstable commit - driver seems to work, most plugins still need testing
* Modified the streams driver to correctly parse the first argument for

PRIVMSG events into an array

* Added a new debug flag setting to the bundled configuration file
* Moved the debug method from the streams driver to the base driver and

modified it to use the new debug flag setting

* Renamed CtcpAction? methods to Action in order to make logic for

construction and parsing of related requests more compatible with the
same for other commands

* Moved Event_Handler::getEventSource to Event_Request::getSource
* Added Event_Handler::tinyUrl convenience method for converting URLs to

their TinyURL equivalents

* Improved docblock coverage in various classes
* Changed all plugin calls to getConnection()->getNick() to getIni('nick')
* Fixed a memory leak in the Command plugin class
* Added alternate nick support to the Nickserv plugin
* Too many more to name!

Line 
1<?php
2
3/**
4* @see Phergie_Plugin_Abstract_AdminCommand
5*/
6require_once 'Phergie/Plugin/Abstract/AdminCommand.php';
7
8/**
9* Allows administrators to effectively speak as the bot.
10*/
11class Phergie_Plugin_Say extends Phergie_Plugin_Abstract_AdminCommand
12{
13    /**
14    * Handles a request for the bot to repeat a given message in a specified
15    * channel.
16    *
17    * <code>Botname: say [#chan] message</code>
18    *
19    * @return void
20    */
21    public function onDoSay($what)
22    {
23        $source = $this->getSource();
24        preg_match('{^(#\S+\s)?(.+)}', $what, $match);
25        if (!empty ($match[1])) {
26            $this->doPrivmsg(trim($match[1]), $match[2]);
27        } elseif ($source[0] === '#') {
28            $this->doPrivmsg($source, $what);
29        }
30    }
31}
Note: See TracBrowser for help on using the browser.