Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- #
- # codename "Rei II": Shadowmaster's Irssi Bot
- # rei2-core.pl: Main source code
- #
- # Copyright (C) 2011 by Ignacio Riquelme Morelle <shadowm2006@gmail.com>
- #
- # Permission to use, copy, modify, and/or distribute this software for any
- # purpose with or without fee is hereby granted, provided that the above
- # copyright notice and this permission notice is present in all copies.
- #
- # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- # POSSIBILITY OF SUCH DAMAGE.
- #
- use 5.010;
- use strict;
- use warnings;
- use feature 'switch';
- BEGIN {
- use vars qw{$REI2_ROOT @REI2_SEARCH_PATHS};
- @REI2_SEARCH_PATHS =
- (".", "./rei2", $ENV{HOME}."/rei2", "/usr/share/rei2", "/usr/local/share/rei2");
- for(@REI2_SEARCH_PATHS) {
- -f $_.'/lib/Rei2/Util.pm' and $REI2_ROOT = $_ and last;
- }
- defined $REI2_ROOT
- or die "Could not locate Rei2 root directory in the search path: ".
- join(' ', @REI2_SEARCH_PATHS);
- push @INC, "$REI2_ROOT/lib";
- }
- use S2;
- use Rei2::Util;
- our $VERSION = '0.2.99.99-dev';
- my $config_root = $ENV{HOME}.'/.rei2';
- my $resource_root = $REI2_ROOT;
- sub handle_notice
- {
- my ($sender, $cmd, @parv) = @_;
- print ":$sender $cmd ".join(' ', @parv)."\n";
- }
- my $client = S2->new({
- server => 'chat.freenode.net', port => 6667,
- nickname => 'Rei3_S2_1', password => 'Rei2:suckmydick',
- username => 'rei3', realname => 'Rei 3',
- });
- $client->handler_add('NOTICE', \&handle_notice);
- $client->join('##shadowm');
- my $line;
- while(1)
- {
- # $client->raw('LIST');
- $client->read();
- $client->process();
- }
- 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement