Advertisement
Guest User

redirectbots.pl

a guest
Feb 18th, 2017
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.09 KB | None | 0 0
  1. use strict;
  2. use Irssi;
  3. use Irssi::Irc;
  4.  
  5. use vars qw($VERSION %IRSSI);
  6.  
  7. $VERSION = "1.0";
  8. %IRSSI   = (
  9.     "authors"     => "esc",
  10.     "name"        => "redirectmsg",
  11.     "description" => "Redirect messages to another window",
  12.     "license"     => "GNU GPL v2"
  13. );
  14.  
  15. my $chan = "##crawl";
  16. my @bots = (
  17.     "Rotatell", "Lantell",  "Henzell",     "Sequell",
  18.     "Eksell",   "Jorgrell", "Cheibriados", "Gretell",
  19.     "Kramell"
  20. );
  21.  
  22. sub sig_messagepublic {
  23.     my ( $server, $msg, $nick, $address, $target ) = @_;
  24.  
  25.     if ( $target =~ /^$chan$/
  26.         && grep( /^$nick$/, @bots ) )
  27.     {
  28.         my $windowname = Irssi::window_find_name('redirect');
  29.  
  30.         $windowname->print(
  31.             "REDIRECT : " . $target . " : < " . $nick . ">: " . $msg,
  32.             MSGLEVEL_CLIENTCRAP )
  33.           if ($windowname);
  34.         Irssi::signal_stop();
  35.     }
  36. }
  37.  
  38. my $windowname = Irssi::window_find_name('redirect');
  39. if ( !$windowname ) {
  40.     Irssi::command("window new hidden");
  41.     Irssi::command("window name redirect");
  42. }
  43.  
  44. Irssi::signal_add( { 'message public', 'sig_messagepublic' } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement