8
[irbot.git] / plugins / sample-plugin.inc.php
blobc3d4968db60762da7f5d662896ef5e15a0b979a2
1 <?php
2 class sample implements plugin {
3 private $IRCConn,$formater;
4 private $message;
6 public function __construct($main) {
7 $this->IRCConn = IRCConn::GetInstance();
8 $this->formater = text_format::GetInstance();
11 public function commands_list() {
12 $commands = array(
13 'method1' => array( // !sample method1
14 'accepted_args' => 0,
15 'help' => 'some help for this method1',
16 'type' => 'public',
18 'method2' => array( // !sample method2 arg
19 'accepted_args' => 1,
20 // the \n chr in a double quote string create a new line (2 PRIVMSG)
21 'help' => "some help for this method2\n".$this->formater->bold('one arg').' requier',
22 'type' => 'public',
24 'method3' => array( // /msg BotName sample method3 arg
25 'accepted_args' => 1,
26 'help' => 'some help for this method3',
27 'type' => 'private',
30 return $commands;
33 public function current_message ($message) {
35 $message = array (
36 'type' => PRIVMSG|NOTICE,
37 'from' => Nick (reply to),
38 'to' => BotName / ChannelName,
39 'message' => The message
42 $this->message = $message;
45 function method1 () {
46 $this->IRCConn->privmsg(IRCConn::$channel,'This is the method1');
49 function method2 ($query) {
50 $this->IRCConn->privmsg(IRCConn::$channel,'This is the method2 : '.$query);
53 function method3 ($query,$replyto) {
54 $this->IRCConn->privmsg($replyto,'This is the method3 : '.$query);