]> ruin.nu Git - NDIRC.git/blobdiff - ndbot.pl
Renamed the startup script to ndbot.pl, which is less generic
[NDIRC.git] / ndbot.pl
diff --git a/ndbot.pl b/ndbot.pl
new file mode 100755 (executable)
index 0000000..a14ee36
--- /dev/null
+++ b/ndbot.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -w
+
+#**************************************************************************
+#   Copyright (C) 2009 by Michael Andreen <harvATruinDOTnu>               *
+#                                                                         *
+#   This program is free software; you can redistribute it and/or modify  *
+#   it under the terms of the GNU General Public License as published by  *
+#   the Free Software Foundation; either version 2 of the License, or     *
+#   (at your option) any later version.                                   *
+#                                                                         *
+#   This program is distributed in the hope that it will be useful,       *
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+#   GNU General Public License for more details.                          *
+#                                                                         *
+#   You should have received a copy of the GNU General Public License     *
+#   along with this program; if not, write to the                         *
+#   Free Software Foundation, Inc.,                                       *
+#   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
+#**************************************************************************
+
+use strict;
+use warnings;
+use feature ':5.10';
+use POE qw(Component::IRC::Qnet::State);
+
+eval "require NDIRC::$ARGV[0]";
+
+die $@ if $@;
+
+# We create a new PoCo-IRC object
+my $irc = POE::Component::IRC::Qnet::State->spawn(
+       nick => $ARGV[0],
+       ircname => 'ND bot',
+) or die "Oh noooo! $!";
+
+$irc->service_bots(QBOT => 'P@cservice.netgamers.org');
+
+my $bot = eval "new NDIRC::$ARGV[0]";
+
+POE::Session->create(
+       object_states => [
+               $bot => [ qw(_default _start irc_001 sig_DIE sig_usr1 sig_usr2
+                       signal_handler irc_disconnected irc_invite auth
+                       irc_public irc_msg refresh irc_join) ],
+       ],
+       heap => { irc => $irc },
+);
+
+$poe_kernel->run();