Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.24 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. #
  3. # codename "Rei II": Shadowmaster's Irssi Bot
  4. # rei2-core.pl: Main source code
  5. #
  6. # Copyright (C) 2011 by Ignacio Riquelme Morelle <shadowm2006@gmail.com>
  7. #
  8. # Permission to use, copy, modify, and/or distribute this software for any
  9. # purpose with or without fee is hereby granted, provided that the above
  10. # copyright notice and this permission notice is present in all copies.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  13. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  14. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  15. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  16. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  17. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  18. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  19. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  20. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  21. # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  22. # POSSIBILITY OF SUCH DAMAGE.
  23. #
  24.  
  25. use 5.010;
  26. use strict;
  27. use warnings;
  28. use feature 'switch';
  29.  
  30. BEGIN {
  31.     use vars qw{$REI2_ROOT @REI2_SEARCH_PATHS};
  32.  
  33.     @REI2_SEARCH_PATHS =
  34.         (".", "./rei2", $ENV{HOME}."/rei2", "/usr/share/rei2", "/usr/local/share/rei2");
  35.     for(@REI2_SEARCH_PATHS) {
  36.         -f $_.'/lib/Rei2/Util.pm' and $REI2_ROOT = $_ and last;
  37.     }
  38.  
  39.     defined $REI2_ROOT
  40.         or die "Could not locate Rei2 root directory in the search path: ".
  41.             join(' ', @REI2_SEARCH_PATHS);
  42.  
  43.     push @INC, "$REI2_ROOT/lib";
  44. }
  45.  
  46. use S2;
  47. use Rei2::Util;
  48.  
  49. our $VERSION = '0.2.99.99-dev';
  50.  
  51. my $config_root = $ENV{HOME}.'/.rei2';
  52. my $resource_root = $REI2_ROOT;
  53.  
  54.  
  55. sub handle_notice
  56. {
  57.     my ($sender, $cmd, @parv) = @_;
  58.  
  59.     print ":$sender $cmd ".join(' ', @parv)."\n";
  60. }
  61.  
  62.  
  63. my $client = S2->new({
  64.     server => 'chat.freenode.net', port => 6667,
  65.     nickname => 'Rei3_S2_1', password => 'Rei2:suckmydick',
  66.     username => 'rei3', realname => 'Rei 3',
  67. });
  68.  
  69. $client->handler_add('NOTICE', \&handle_notice);
  70.  
  71. $client->join('##shadowm');
  72.  
  73. my $line;
  74. while(1)
  75. {
  76. #   $client->raw('LIST');
  77.     $client->read();
  78.     $client->process();
  79. }
  80.  
  81. 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement