bind_timer

Name

bind_timer -- Make a method be called with a given frequency

Synopsis

void bind_timer(string method, double frequency);

Description

Wollabot 0.3.0 introduces the concept of timers which enables you to run a user-defined method at a given frequency specified in ms.

Note

Bear in mind that this bind method does not supply you with a $data parameter for obvious reasons.

Example 3-1. Printing the time every five minutes

class MyModule extends Wollabot_Module {

  function MyModule () {
    $this->bind_timer('print_time', 300000);
  }

  function print_time () {
    $this->privmsg("#wollabot", "Time is now:".date("d/m/Y H:i:s"));
  }

}

$wollabot->register_module("MyModule");