add onUnknow() event
[irbot.git] / plugins / sample / method1.php
blobbc167171970cc72597de250f3feb341464264ed3
1 <?php
2 /**
3 * This file is part of IrBot, irc robot.
4 * Copyright (C) 2007-2008 Bellière Ludovic
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @category IrBot
20 * @package IrBot_Plugins
21 * @copyright Copyright (c) 2008 Bellière Ludovic
22 * @license http://www.gnu.org/licenses/gpl-3.0.html
25 /**
26 * @see Plugins_Command_Abstract
28 require_once(BASE_DIR.'Plugins/Command/Abstract.php');
30 class Plugin_Sample_Method1 extends Plugins_Command_Abstract {
32 protected $_ircmain;
34 public function __construct(Plugins_Abstract $plugin,IRCMain $ircmain) {
35 parent::__construct($plugin);
36 $this->_ircmain = $ircmain;
37 $this->_helpMessage = 'some help for this method1';
39 $options = array(
40 self::REQUIERED_ARGS => 0,
41 self::ACCEPTED_ARGS => 0,
42 self::COMMAND_VISIBILITY => self::TYPE_PUBLIC
45 self::setOptions($options);
49 public function doAction() {
50 if ($this->_event->isForChannel()) {
51 $this->ircmain->privmsg($this->_event->getDataFor(),'This is the method1');
52 } else {
53 $this->ircmain->privmsg($this->_event->getDataFor(),'Sorry, but this command is for public channel only.');
57 public function getType() {
58 return $this->_defaults[self::COMMAND_VISIBILITY];
61 public function __toString() {
62 return "method1";