13
[irbot.git] / plugins / sample-plugin.inc.php
blob6e577a073850165ece4cea22bd622ff8cb3e1f1f
1 <?php
2 class sample implements plugin {
3 private $IRCConn,$formater;
4 private $message;
6 public function __construct($main) {
7 $this->IRCConn = bot::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(bot::$channel,'This is the method1');
49 function method2 ($query) {
50 $this->IRCConn->privmsg(bot::$channel,'This is the method2 : '.$query);
53 function method3 ($query) {
55 if (bot::$myBotName == $this->message['to']) {
56 $replyto = $this->message['from'];
57 } else {
58 $replyto = $this->message['to'];
61 $this->IRCConn->privmsg($replyto,'This is the method3 : '.$query);