Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package Sedbot::Plugin::Parrot;
  2. use base qw(Sedbot::Plugin);
  3.  
  4. use strict;
  5. use warnings;
  6. use utf8;
  7.  
  8. my %parrot;
  9.  
  10. sub said {
  11. my ($self, $message) = @_;
  12. my $body = $message->{body};
  13. my $nick = $message->{who};
  14. my $chan = $message->{channel};
  15.  
  16. return if $message->{channel} eq "msg";
  17.  
  18. if ($body =~ /^:parrot add (\S+) (\S+)/) {
  19. $parrot{$1} = $2;
  20. }
  21.  
  22. elsif ($body =~ /^:parrot del (\S+)/) {
  23. delete $parrot{$1};
  24. }
  25.  
  26. elsif ($parrot{$chan}) {
  27. $self->bot->say(channel => $parrot{$chan}, body => "$chan <$nick> $body");
  28. }
  29. return;
  30. }
  31.  
  32. 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement