Advertisement
teknogeek

Simple hello world plugin

May 12th, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.70 KB | None | 0 0
  1. # this gets called when the plugin is loaded
  2. sub start {
  3.     my $class = shift;
  4.     my ($kernel, $heap) = @_[KERNEL, HEAP];
  5.  
  6.     # here you register what keywords this plugin should respond to
  7.     register_request_keywords($class, 'helloworld', "helloworld: Example plugin, useful for testing if the bot is working. Usage: helloworld");
  8. }
  9.  
  10. # got a request
  11. sub got_request {
  12.     my $class = shift;
  13.     my ($kernel, $heap, $user, $location, $replyto, $extra, $keyword, $message) = @_[KERNEL, HEAP, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5];
  14.  
  15.     # $keyword gets set to the command the user used to trigger this plugin
  16.     # $message gets set to the rest of the line
  17.  
  18.     # this is how you reply to a
  19.     reply($kernel, $replyto, $extra, "Hello, World!");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement