]> ruin.nu Git - NDIRC.git/blob - ndbot.pl
Updated -user to account for discord id
[NDIRC.git] / ndbot.pl
1 #!/usr/bin/perl -w
2
3 #**************************************************************************
4 #   Copyright (C) 2009 by Michael Andreen <harvATruinDOTnu>               *
5 #                                                                         *
6 #   This program is free software; you can redistribute it and/or modify  *
7 #   it under the terms of the GNU General Public License as published by  *
8 #   the Free Software Foundation; either version 2 of the License, or     *
9 #   (at your option) any later version.                                   *
10 #                                                                         *
11 #   This program is distributed in the hope that it will be useful,       *
12 #   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14 #   GNU General Public License for more details.                          *
15 #                                                                         *
16 #   You should have received a copy of the GNU General Public License     *
17 #   along with this program; if not, write to the                         *
18 #   Free Software Foundation, Inc.,                                       *
19 #   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
20 #**************************************************************************
21
22 use strict;
23 use warnings;
24 use feature ':5.10';
25 use local::lib;
26
27 use File::Basename;
28 use lib dirname (__FILE__) . "/..";
29
30
31 #use Devel::Leak::Object qw{ GLOBAL_bless };
32 use POE qw(Component::IRC::Qnet::State Loop::Mojo_IOLoop);
33
34 use Moose;
35 use MooseX::Declare;
36 use MooseX::Declare::StackItem;
37 use Parse::Method::Signatures::Sig;
38 use MooseX::Types::TypeDecorator;
39 use MooseX::Meta::TypeConstraint::ForceCoercion;
40
41 use NDIRC::Bot;
42
43 eval "require NDIRC::$ARGV[0]";
44
45 die $@ if $@;
46
47 # We create a new PoCo-IRC object
48 my $irc = POE::Component::IRC::Qnet::State->spawn(
49         nick => $ARGV[0],
50         ircname => 'ND bot',
51 ) or die "Oh noooo! $!";
52
53 $irc->service_bots(QBOT => 'P@cservice.netgamers.org');
54
55 my $bot = eval "new NDIRC::$ARGV[0]";
56
57 POE::Session->create(
58         object_states => [
59                 $bot => [ qw(_default _start irc_001 sig_DIE sig_usr1 sig_usr2
60                         signal_handler irc_disconnected irc_invite auth
61                         irc_public irc_msg refresh irc_join) ],
62         ],
63         heap => { irc => $irc },
64 );
65
66 $poe_kernel->run();
67
68 1;