Takumi Akiyama > Skype-Any-0.06 > Skype::Any::Declare

Download:
Skype-Any-0.06.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Skype::Any::Declare - Addition of an interface similar to hubot for Skype::Any

SYNOPSIS ^

  use Skype::Any::Declare;

  skype(name => 'ping-pong');

  hear 'ping' => sub {
      my ($msg) = @_;
      $msg->chat->send_message('pong');
  };

  run;

DESCRIPTION ^

Skype::Any::Declare has interface similar to hubot.

FUNCTIONS ^

skype

Return Skype::Any object. Also, this function can specify arguments to pass to the object.

respond

  respond qr/pattern/ => sub { my ($chatmessage, @match) = @_; ... };
  respond 'string' => sub { my ($chatmessage, @match) = @_; ... };

Register handlers which is called if a message matches regexp. (Only when you received a message from 1:1 chat)

$chatmessage is Skype::Any::Object::ChatMessage object, @match is subgroups in regexp.

  respond 'yes'     => sub { $_[0]->chat->send_message('no') },
          'stop'    => sub { $_[0]->chat->send_message('go go go') },
          'goodbye' => sub { $_[0]->chat->send_message('hello') };

hear

  hear qr/pattern/ => sub { my ($chatmessage, @match) = @_; ... };
  hear 'string' => sub { my ($chatmessage, @match) = @_; ... };

Register handlers which is called if a message matches regexp. (Only when you received a message from group chat)

$chatmessage is Skype::Any::Object::ChatMessage object, @match is subgroups in regexp.

  hear qr/\A([0-9]{1,2}) : ([0-9]{1,2}) \s+ (.+)\z/xms => sub {
      my ($msg, $hour, $min, $reminder) = @_;
      ...
  };

run

  run;

Running event loop.

SEE ALSO ^

Skype::Any

syntax highlighting: