]> ruin.nu Git - NDIRC.git/blobdiff - ndawn.pl
Use Moose and make the bots object-oriented with Bot as base class
[NDIRC.git] / ndawn.pl
index ca60ea24e1c6593a29fe7339661c61290e15eafa..a14ee36fe319bef16eaaeb34b7eda5d8c3e5acf3 100755 (executable)
--- a/ndawn.pl
+++ b/ndawn.pl
@@ -24,8 +24,6 @@ use warnings;
 use feature ':5.10';
 use POE qw(Component::IRC::Qnet::State);
 
-
-use NDIRC::CommonStates;
 eval "require NDIRC::$ARGV[0]";
 
 die $@ if $@;
@@ -38,11 +36,13 @@ my $irc = POE::Component::IRC::Qnet::State->spawn(
 
 $irc->service_bots(QBOT => 'P@cservice.netgamers.org');
 
+my $bot = eval "new NDIRC::$ARGV[0]";
+
 POE::Session->create(
-       package_states => [
-               'NDIRC::CommonStates' => [ qw(_default _start irc_001 sig_DIE sig_usr1 sig_usr2
-                       signal_handler irc_disconnected irc_invite auth) ],
-               "NDIRC::$ARGV[0]" => [ qw(irc_public irc_msg refresh irc_join) ],
+       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 },
 );