bind_chan

Name

bind_chan -- Binds an IRC message on a given channel to a given method

Synopsis

void bind_chan(string method, string channel);

Description

This method binds IRC messages on a given channel or all channels setting channel to all. If you want to bind your method to multiple channels simply run bind_chan multiple times as well.

Example 3-1. Repeat module for a single channel

class MyModule extends Wollabot_Module {

  var $last_message;

  function MyModule () {
    $this->bind_chan('check_repeat', '#wollabot');
  }

  function do_logging ($data) {

    if (isset($this->last_message) && $this->last_message == $data['message']) {
      $this->privmsg($data['channel'], $data['message']);
    }

    $this->last_message = $data['message'];

  }

}

$wollabot->register_module("MyModule");