Skip to content

Instantly share code, notes, and snippets.

@am0c
Created October 19, 2012 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save am0c/3916344 to your computer and use it in GitHub Desktop.
Save am0c/3916344 to your computer and use it in GitHub Desktop.
Hubot::Listener.pm6
use v6;
class Hubot::Listener {
has Code $.match is rw;
has Code $.callback is rw; # handles cb => postcircum:<( )>
# .. does not work
method call ($message --> Bool) {
my @matching = $.match.($message);
if @matching {
$.callback: Hubot::Response.new:
robot => self.robot,
message => $message,
match => @matching;
return True;
}
False;
}
}
# vim: set ft=perl6 sts=4 sw=4 ts=4 expandtab :
use v6;
use Hubot::Response;
class Hubot::Listener {
has Code $.match is rw;
has Code $.callback is rw; # handles cb => postcircum:<( )>
# .. does not work
method call ($message --> Bool) {
my @matching = $.match.($message);
if @matching {
$.callback: Hubot::Response.new:
robot => self.robot,
message => $message,
match => @matching;
return True;
}
False;
}
}
# vim: set ft=perl6 sts=4 sw=4 ts=4 expandtab :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment