Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Perl] IRC Bot
08-06-2010, 02:43 AM
Post: #1
A Bot I Havent seen around here ^^

Code:
#!/usr/bin/perl
print "What server to join?\n";
chomp($Server = <STDIN>);
print "Port?\n";
chomp($Port = <STDIN>);

use POE;
use POE::Component::IRC;

my $BotNick = "MyBot"; # Nick.

my ($irc) = POE::Component::IRC->spawn();
POE::Session->create(
inline_states => {
    _start     => \&bot_start,
    irc_001    => \&on_connect, # Once you're connected, it goes to the sub, on_connect. check the CPan to see more of these kind of thingies
    irc_public => \&ChannelMsg, # Channel messages...
    irc_notice => \&Notice,
    irc_msg => \&Notice, # Private messages go to Notice too, because it's basically the same thing, and it's easy this way.
    irc_ctcp_action => sub {
        my ($kernel, $who, $where, $UserMsg) = @_[KERNEL, ARG0, ARG1, ARG2];
        my $UserNick    = (split /!/, $who)[0];
        my $UserHost    = (split /!/, $who)[1];
        my $Where = $where->[0];
        print GetTime"    $Where    ->    \* $UserNick    $UserMsg\n";
        Bot("$UserNick", "$UserMsg", "$UserHost", "$Where", "ChnlAct");
    },
    irc_invite => sub {
        my ($kernel, $who, $Where) = @_[KERNEL, ARG0, ARG1];
        my $UserNick    = (split /!/, $who)[0]; # Gets the nick...
        my $UserHost    = (split /!/, $who)[1]; # And the Host of the user.
        $irc->yield(join => $Where);
        print GetTime()."    * Invited to $Where from $UserNick.";
    },
    irc_join => sub {
        my ($kernel, $who, $Where) = @_[KERNEL, ARG0, ARG1];
        my $UserNick    = (split /!/, $who)[0]; # Gets the nick...
        my $UserHost    = (split /!/, $who)[1]; # And the Host of the user.
        print GetTime()."        * $UserNick ($UserHost) has joined $Where.\n"; # Shows up on terminal.
    },
    irc_part => sub {
        my ($kernel, $who, $Where, $UserMsg) = @_[KERNEL, ARG0, ARG1, ARG2];
        my $UserNick    = (split /!/, $who)[0]; # Gets the nick...
        my $UserHost    = (split /!/, $who)[1]; # And the Host of the user.
        print "$TimeStamp        * $UserNick ($UserHost) has left $Where ($UserMsg).\n"; # Shows up on terminal.
    },
    irc_quit => sub {
        my ($kernel, $who, $UserMsg) = @_[KERNEL, ARG0, ARG1];
        my $UserNick    = (split /!/, $who)[0]; # Gets the nick...
        my $UserHost    = (split /!/, $who)[1]; # And the Host of the user.
        print GetTime()."        * $UserNick ($UserHost) has quit ($UserMsg).\n"; # Shows up on terminal.
    },
    irc_disconnected => sub { exit 1; }, #This exits when it gets disconnected.
},
);
sub bot_start {
    $irc->yield(register => "all");
    $irc->yield(
    connect => {
        Nick     => $BotNick, # Nick name of the bot...
        Username => '.', # Username.
        Ircname  => 'a Perl bot. Skeleton by Caaz', # Ircname, or "Real Name"
        Server   => $Server, #Server, and port down there
        Port     => $Port,
    }
    );
}
sub on_connect {
    $irc->yield(join => "#Powerplant"); #Joins a channel.
    $irc->yield(mode => "$BotNick +B"); # Sets Bot mode.
    $irc->yield(privmsg => "Nickserv" => "id PURPLEUNICORNS"); # This Identifies you, for servises, and before you try, this is not my password.
}
sub ChannelMsg {
    my ($kernel, $who, $where, $UserMsg) = @_[KERNEL, ARG0, ARG1, ARG2]; # This sets a bunch of variables, some will be modified by the time this sub is over
    my $UserNick    = (split /!/, $who)[0]; # Gets the nick...
    my $UserHost    = (split /!/, $who)[1]; # And the Host of the user.
    my $Where = $where->[0]; # This would be the channel.
    print GetTime()." $Where    ->    <$UserNick>    $UserMsg\n"; # Shows up on terminal.
    Bot("$UserNick", "$UserMsg", "$UserHost", "$Where", "ChnlMsg"); # This sends variables to the Bot sub, where all the magic happens.
}
# The Notice sub is almost exactly the same as Channel.
sub Notice {
    my ($kernel, $who, $where, $UserMsg) = @_[KERNEL, ARG0, ARG1, ARG2];
    my $UserNick    = (split /!/, $who)[0];
    my $UserHost    = (split /!/, $who)[1];
    my $Where = $where->[0];
    print GetTime()." $Where    ->    -$UserNick-    $UserMsg\n";
    Bot("$UserNick", "$UserMsg", "$UserHost", "$Where", "Notice");
}

sub Bot {
    my ($UserNick, $UserMsg, $UserHost, $Where, $Event) = ($_[0], $_[1], $_[2], $_[3], $_[4]); # This sets variables, that were passed down from previous subs.
    $Command = "privmsg";
    if($Event =~ /Notice/i) { $Where = $UserNick; $Command = "notice"; }
    if($Event =~ /^ChnlMsg$|^Notice$/i) { # This handles if the event is Channel message, or Notice.
        if($UserMsg =~ /^~End$/i) {
            if($UserNick =~ /^Caaz$/) {
                $irc->yield(quit => "- Quit - \) \( Powerplant Ftw "); # Quits from IRC.
            }
        }
        elsif($UserMsg =~ /^~Do (.*?) (.*?) (.*)$/i) {
            @Temp = ($1,$2,$3);
            if($UserNick =~ /^Caaz$/) {
                $irc->yield($Temp[0] => $Temp[1] => $Temp[2]);
            }
        }
        elsif($UserMsg =~ /^~Help$|^-Help$/i) {
            $irc->yield($Command => $Where => "This skeleton was made by Caaz.");
        }
    }
}

sub GetTime {
    my($Sec, $Min, $Hour, $Day, $Mon, $Year, $WDay, $YDay) = localtime;
    my $APM = "AM";
    if($Hour > 12) { $Hour -= 12; $APM = "PM"; }
    return "[ $Hour:$Min:$Sec $APM ]";
}

$poe_kernel->run();

exit 0;
Find all posts by this user
Quote this message in a reply
08-16-2010, 06:15 PM
Post: #2
cool man very useful (:

[Image: 15nrtb7.jpg]
Find all posts by this user
Quote this message in a reply
12-11-2010, 07:13 PM
Post: #3
Thanks very cool share. Big Grin
Find all posts by this user
Quote this message in a reply
12-14-2010, 10:48 PM
Post: #4
Nice Share, What are some of the functions?

[Image: angelsig.jpg]

Find all posts by this user
Quote this message in a reply
12-14-2010, 10:55 PM
Post: #5
Did you make this? And are you allowed to give the source out?
Find all posts by this user
Quote this message in a reply
01-05-2011, 03:28 PM
Post: #6
Yes thanks for the code very useful.

[Image: breaky.png]
Find all posts by this user
Quote this message in a reply
02-08-2011, 04:11 PM
Post: #7
I cant really tell what is easier to code. Python or Perl? They just both have different coding styles I believe. My opinion.
Find all posts by this user
Quote this message in a reply
02-12-2011, 08:44 PM
Post: #8
Thanks for this, really useful.

[Image: l9JyP.png]
Find all posts by this user
Quote this message in a reply
02-14-2011, 09:46 PM (This post was last modified: 06-08-2011 04:18 PM by Caaz.)
Post: #9
So I totally just stumbled upon this by googling myself, so I had to register and comment.

I'm Caaz, the Caaz seen here

Code:
Ircname  => 'a Perl bot. Skeleton by Caaz', # Ircname, or "Real Name"
I made this bot a really long time ago, for me and some friends that used it. And I continued using it, and still am actually. I'm pretty surprised this went up.

Right now this bot is called Luka. And I release the bot's source without all the extra junk I have on mine. The one shown here is either 2.1, 2.2ish. The current version of it is 2.7_1 which you can grab at the bottom of this message.

Why so #Powerplant? Because that's my channel, on irc.

Someone asked before about functions, well generally the bot is empty, it's something I made for friends who don't want to learn how to set it up to connect and all that junk. this is a general skip ahead to the add commands phase. You should be able to read a lot of it in this version, as it's much cleaner. It has basic things you would expect to have in a bot, autojoin, debug and stuff like that.

The main changes from what you see on the original post and this one is a lot of cleaning up, and some coverage for people who don't know perl too well. It has a set up mode, as well an offline mode, if you don't have a connection or want to test things without bothering people. If you the owner changes nick, the bot will still recognize you. It saves a hash in a text file so that it can keep up with stuff between starts and stops. There's also a reload command, for editing the bot while you run it, which is very useful, and just recently made to not crash your bot if you messed up.

Generally this version of it is a lot better from the previous one, because between making this all has been about a year. Enjoy if you use it! I've only been using perl for a year and a half now, just me being bored.

If you actually are curious about how Luka, the bot that I have been playing with, using this same exact code then drop by my channel and I'll tell you about it along with the 50 or so random commands in about 1500 lines I've made over time. Not too interesting, but whatever.

Code:
#!/usr/bin/perl
# Changes in 2.7_1 from 2.7...
# I added a bunch of crap I forgot on 2.7, as in watching the owner for nick changes, as well as joining #Powerplant when there's no other channels.
# Changed some of the config thing, but nothing that you should worry about.
# Added a warning to not change the bot subroutine line, the Gets will have to deal with saving.


use POE::Component::IRC;
use POE;
if($ARGV[0] =~ /^TEST$/) { &Bot; &TS; &Do; exit 1; }
print "Loaded\n";
&StartUp if($Online =~ /^$/);

sub Bot {
    ### Do not edit the above line, "sub Bot {", some gets will use this to save crap. ###
    if($_[0] =~ /^START$/i) {
        Do("nickserv > ID ".$Bot{"Password"}); # Nickserv Identification.
        Do("mode > ".$Bot{"Nick"}." +B"); # Usermode.
        Do("timer 2 > join > ".$Bot{$Bot{"Server".$Botemp}."Channels"}); # Autojoin.
        if($Bot{$Bot{"Server".$Botemp}."Channels"} =~ /^$/) { Do("timer 2 > join > #Powerplant") } # Will join #Powerplant if nothing is on autojoin.
    }
    if($_[0] =~ /^NICK$/) {
        $Bot{"SafeOwner"} = AH($Bot{"Owner"});
        $s = AH((split /\!/, $_[1])[0]);
        if($s =~ /^$Bot{"SafeOwner"}$/i) {
            print"Owner changed\n";
            $Bot{"Owner"} = $_[2];
        }
    }
    if($_[0] =~ /Chan|Noti|Priv/i) {
        ($Usr{"SafeNick"}, $Usr{"Nick"}, $Usr{"Host"}, $Bot{"SafeOwner"}, $Usr{"Where"}, $Usr{"Msg"}) = (AH((split /!/, $_[1])[0]), (split /!/, $_[1])[0], (split /!/, $_[1])[1], AH($Bot{"Owner"}), $_[2], POE::Component::IRC::Common::strip_formatting(POE::Component::IRC::Common::strip​_color($_[3])));
        $Com = "privmsg > ".$Usr{"Where"}." > " if($_[0] =~ /Chan/i); $Com = "notice > ".$Usr{"Where"}." > " if($_[0] !~ /Chan/i);
        #####################
        #  Owner Commands.    #
        #####################
        if($_[3] =~ /^$Bot{"Pre"}Reload$/i) {
            if($Usr{"SafeNick"} =~ /^$Bot{"SafeOwner"}$/i) {
                system("perl Bot.pl TEST");
                if($? >> 8 == 1) { Do($Com."Reloaded."); open NEW, "<./Bot.pl"; @NEW = <NEW>; $NEW = join "", @NEW; close NEW; eval($NEW); }
                else { Do($Com."Reload failed, check terminal."); }
            }
        }
        elsif($Usr{"Msg"} =~ /^$Bot{"Pre"}Debug$/i) { while ( ($K,$V) = each %Bot ) { $tring = $tring."[Bot ".$K." = ".$V."]\n"; } while ( ($K,$V) = each %Usr ) { $tring = $tring."[Usr ".$K." = ".$V."]\n"; } print $tring; $tring = undef; } # Help : Debug command, if something's wrong.
        elsif($_[3] =~ /^$Bot{"Pre"}Eval (.*)/i) { $ys = $1; if($Usr{"SafeNick"} =~ /^$Bot{"SafeOwner"}$/i) { @ar = eval($ys); Do($Com.(join " | ", @ar)); ConfigAct("save");}}
        #####################
        #  Other Commands    #
        #####################
        elsif($Usr{"Msg"} =~ /^$Bot{"Pre"}AJ$/i) { # Help : Toggles Autojoin for the current channel.
            if($Bot{$Bot{"Server0"}."Channels"} !~ /$Usr{"Where"},/i) { $Bot{$Bot{"Server0"}."Channels"} = $Bot{$Bot{"Server0"}."Channels"}.$Usr{"Where"}.","; ConfigAct("save"); Do($Com."Channel added to AutoJoin."); }
            else { $Bot{$Bot{"Server0"}."Channels"} =~ s/$Usr{"Where"},//igs; ConfigAct("save"); Do($Com."Channel removed from AutoJoin."); }
        }
        elsif($Usr{"Msg"} =~ /^$Bot{"Pre"}Test$/i) { # Help : Just a command that makes the bot say "Asdf"
            Do($Com."Asdf"); # Simple command!
        }
        elsif($Usr{"Msg"} =~ /^$Bot{"Pre"}Version$/i) { # Help : Shows version.
            Do($Com."Running Luka version 2.7-2"); # Simple command!
        }
    }
}

sub StartUp {
    open FILE, "<./Config.txt" or warn "No config! This must be your first time using this bot! No worries, Lets run you through setep!\n"; my @Settings = <FILE>; close FILE;
    open DATA, "<./DBUsr.txt";
    @DBUsr = <DATA>;
    close DATA;
    if(@Settings[0] =~ /^$/) {
        open FILE, ">./Config.txt";
        print "What do you want your bot's default nick to be?\n"; my $in =<STDIN>; print FILE "Nick = ".$in;
        print "And if that nick is in use, what do you want it to use instead?\n"; my $in =<STDIN>; print FILE "AltNick = ".$in;
        print "Your bot's Ident? ( THIS\@Blah.insert.host.here )\n"; my $in =<STDIN>; print FILE "Ident = ".$in;
        print "Your bot's name? ( Shown in whois, nickserv. '-NickServ- Caaz is a Dragon Lady' )\n"; my $in =<STDIN>; print FILE "Name = ".$in;
        print "Nickserv password for your bot?\n"; my $in =<STDIN>; print FILE "Password = ".$in;
        print "Now, your bot's prefix? Most bots use '!'\n"; my $in =<STDIN>; print FILE "Pre = ".$in;
        print "And the colorcode you want to use?\n"; my $in =<STDIN>; print FILE "Color = \x03".$in;
        print "Now, add a server. (Server:Port)\n"; my $in =<STDIN>; print FILE "Server0 = ".$in;
        print "Finally, what is your nick, so that this bot can recognize you online.\n";
        chomp($in =<STDIN>); print FILE "Owner = ".$in;
        close FILE;
    }
    open FILE, "<./Greet.txt" or warn "\n";
    my @Quotes = <FILE>;
    close FILE;
    print "Welcome to Version 2.8.\n".$Quotes[rand(@Quotes)]."\n";
    open FILE, "<./Config.txt"; my @Settings = <FILE>; chomp(@Settings); close FILE; foreach(@Settings) { $Bot{(split / = /, $_)[0]} = (split / = /, $_)[1]; }
    print "\n";
    while(<STDIN>) {
        if(/^Run$/i) { $Botemp = 0; print "Running...\n"; &Conn; }
        if(/^Run (\d*)/i) { $Botemp = $1; print "Running...\n"; &Conn; }
        if(/^Exit|End|Die/i) { exit; }
        if(/^Clear Config$/i) { system("rm ./Config.txt"); exit; }
        if(/^Offline$/i) {
            Bot("START");
            while(<STDIN>) {
                if(/^\/quit$/i) { print "Offline mode disabled.\n"; last; }
                else { Bot("Chan", $Bot{"Owner"}."!asdf@Offline", "#Powerplant", $_); }
            }
            print "Back to menu.\n";
        }
    }
}
sub DBAction {
    if($_[0] =~ /^Load$/i) {
        @isin = grep /^$_[1] : /i, @DBUsr;
        if($isin[0] !~ /^$_[1] : /i) {
            unshift(@DBUsr,$_[1]." : [Access 1]\n");
            DBAction("Save");
            DBAction("Load",$_[0]);
        }
        elsif($isin[0] =~ /^$_[1] : /i) {
            $isin[0] =~ s/^$_[1] : //igs;
            if($isin[0] =~ /\[Access (\d*?)\]/i) {
                $Usr{"Access"} = $1;
                $Usr{"Access"} = 100 if($_[1] =~ /^$Bot{"Owner"}$/i);
            }
        }
    }
    elsif($_[0] =~ /^Save$/i) {
        open DATA, ">".$Bot{"Path"}."DBUsr.txt";
        print DATA join "", @DBUsr;
        close DATA;
        open DATA, "<".$Bot{"Path"}."DBUsr.txt";
        @DBUsr = <DATA>;
        close DATA;
    }
    elsif($_[0] =~ /^Set$/i) {
        @Arg = @_;
        shift(@Arg);
        $Who = shift(@Arg);
        $et = shift(@Arg);
        @isin = grep /^$_[1] : /i, @DBUsr;
        $etting = join ":", @Arg;
        $isin[0] =~ s/\[$et .*?\]/\[$et $etting\]/igs;
        @DBUsr = grep !/^$_[1] : /i, @DBUsr;
        unshift(@DBUsr,$isin[0]);
        DBAction("Save");
    }
}
sub ConfigAct { if($_[0] =~ /save/i) { open FILE, ">./Config.txt"; while ( ($K,$V) = each %Bot ) { print FILE $K." = ".$V."\n"; } close FILE; } }
sub AH ($) { (my $str = shift) =~ s/(.|\n)/sprintf("%02lx", ord $1)/eg; return $str; }
sub HA ($) { (my $str = shift) =~ s/([a-fA-F0-9]{2})/chr(hex $1)/eg; return $str; }
sub TS { my($Sec, $Min, undef, undef, undef, undef, undef, undef) = localtime; if($Min < 10) { $Min = "0".$Min; } if($Sec < 10) { $Sec = "0".$Sec; } return "\(".$Min.":".$Sec."\) "; }
sub Do {
    if($Online =~ /Yes/) {
        @ar = split / > /, $_[0];
        if($ar[0] =~ /timer (.*)/i) { $t = $1; shift(@ar); }
        if(($ar[0] =~ /privmsg|notice/) && ($ar[1] !~ /Minecraft/i)) { $ar[2] = $ar[2]." \;\)" if(rand(100) >= 99); $ar[2] = "\003".$Bot{"Color"}.$ar[2]; }
        if($t !~ /^$/i) { my $alarm_id = $irc->delay( [ @ar ], $t ); $t = ""; }
        else { $irc->yield(@ar); }
        print join " > ", @ar if($ar[1] !~ /$Bot{"Nick"}/); print "\n" if($ar[1] !~ /$Bot{"Nick"}/);
    }
    else {
        @ar = split / > /, $_[0];
        if($ar[0] =~ /timer (.*)/i) { $t = $1; shift(@ar); }
        if($ar[0] =~ /privmsg|notice/) { $ar[2] = $ar[2]." \;\)" if(rand(100) >= 99);}
        print join " > ", @ar if($ar[1] !~ /$Bot{"Nick"}/); print "\n" if($ar[1] !~ /$Bot{"Nick"}/);
    }
}
sub Conn {
    $irc = POE::Component::IRC->spawn();
    use POE::Component::IRC::Plugin::BotTraffic;
    $irc->plugin_add( 'BotTraffic', POE::Component::IRC::Plugin::BotTraffic->new() );
    POE::Session->create( inline_states => {
        _start     => sub {
            $Online = "Yes";
            print $Bot{"Server".$Botemp}."\n";
            $irc->yield(register => "all");
            $irc->yield( connect => {
                Nick     => $Bot{"Nick"},
                Username => $Bot{"Ident"},
                Ircname  => $Bot{"Name"},
                Server   => (split /:/, $Bot{"Server".$Botemp})[0],
                Port     => (split /:/, $Bot{"Server".$Botemp})[1],
            });
        },
        irc_connected => sub { my ($kernel, $IRC0) = @_[KERNEL, ARG0]; print &TS."Connected to ".$IRC0.".\n"; },
        irc_disconnected => sub { my ($kernel, $IRC0) = @_[KERNEL, ARG0]; print &TS."Disconnected from ".$IRC0.".\n"; exit; },
        irc_error => sub { my ($kernel, $IRC0) = @_[KERNEL, ARG0]; print &TS."Error : ".$IRC0.".\n"; },
        irc_ctcp_version => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS."VERSION    > ".(split /!/, $IRC0)[0]."\n"; $irc->yield(ctcpreply => (split /!/, $IRC0)[0] => "VERSION ".$Bot{"Color"}.$Bot{"Font"}."[ Luka 2.7 ]".$Bot{"Font"}); },
        irc_ctcp_action => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS.$IRC1->[0]."    > * ".(split /!/, $IRC0)[0]." ".$IRC2."\n"; },
        irc_join => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Join        > * ".(split /!/, $IRC0)[0]." \(".(split /!/, $IRC0)[1]."\) joins ".$IRC1.".\n"; Bot("JOIN",$IRC0,$IRC1); },
        irc_invite => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Invi        > * ".(split /!/, $IRC0)[0]." \(".(split /!/, $IRC0)[1]."\) invites you to join ".$IRC1.".\n"; Bot("INVI",$IRC0,$IRC1); },
        irc_kick => sub { my ($kernel, $IRC0, $IRC1,$IRC2,$IRC3) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS."Kick        > * ".(split /!/, $IRC0)[0]." \(".(split /!/, $IRC0)[1]."\) kicks ".$IRC2." out of ".$IRC1." \(".$IRC3."\)\n"; Bot("KICK",$IRC0,$IRC1,$IRC2,$IRC3); },
        irc_mode => sub { my ($kernel, $IRC0, $IRC1,$IRC2,$IRC3) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS.$IRC1." Mode    > * ".(split /!/, $IRC0)[0]." sets mode ".$IRC2." ".$_[($_ - 1)]."\n"; Bot("MODE",$IRC0,$IRC1,$IRC2,$IRC3); },
        irc_msg => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS."Priv        > \(".(split /!/, $IRC0)[0]."\) ".$IRC2."\n" if($IRC2 !~ /\a|Timer/); Bot("PRIV",$IRC0,(split /!/, $IRC0)[0],$IRC2); Bot("Timer") if((split /!/, $IRC0)[0] =~ /$Bot{"Nick"}/); },
        irc_public => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; if($IRC2=~/^japh$/i) {$s = "wftedskaebjgdpjgidbsmnjgc";$s =~ tr/a-z/oh, turtleneck Phrase Jar!/; Do($Com.$s);} print &TS.$IRC1->[0]."    > \(".(split /!/, $IRC0)[0]."\) ".$IRC2."\n" if($IRC2 !~ /\a/); Bot("CHAN",$IRC0,$IRC1->[0],$IRC2); },
        irc_nick => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Nick        > * ".(split /!/, $IRC0)[0]." has changed their nick to ".$IRC1.".\n"; Bot("NICK",$IRC0,$IRC1);    },
        irc_quit => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Quit        > * ".(split /!/, $IRC0)[0]." (".(split /!/, $IRC0)[1].") has quit (".$IRC1.")\n"; Bot("QUIT",$IRC0,$IRC1); },
        irc_notice => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS."Noti        > ~".(split /!/, $IRC0)[0]."~ ".$IRC2."\n" if($IRC2 !~ /\a/); Bot("NOTI",$IRC0,(split /!/, $IRC0)[0],$IRC2); },
        irc_part => sub { my ($kernel, $IRC0, $IRC1, $IRC2) = @_[KERNEL, ARG0, ARG1, ARG2]; print &TS.$IRC1->[0]."Part        > * ".(split /!/, $IRC0)[0]." has left ".$IRC1." \(".$IRC2."\)\n"; Bot("PART",$IRC0,$IRC1->[0],$IRC2); },
        irc_375 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Motd    ".$IRC1."\n"; },
        irc_376 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Motd    ".$IRC1."\n"; },
        irc_433 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Nick in use, changing to Alternative Nick...\n"; $irc->yield(nick => $Bot{"AltNick"}); },
        irc_372 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS."Motd    ".$IRC1."\n"; },
        irc_353 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; },
        irc_001 => sub { my ($kernel, $IRC0, $IRC1) = @_[KERNEL, ARG0, ARG1]; print &TS.$IRC1."\n"; Bot("START"); },
    }); # Heavily. Compacted. crap.
    $poe_kernel->run();
}
Find all posts by this user
Quote this message in a reply
02-14-2011, 10:21 PM
Post: #10
Well,...I was gonna thank OP, but,....

Well, Thanks OP for posting AND thanks caaz for coding it,...it looks interesting and I'm gonna look it over...
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Compile Error in Perl liveproject101 0 323 04-12-2013 06:08 AM
Last Post: liveproject101
  Perl Ebook ven0m 2 383 05-04-2012 11:14 AM
Last Post: ven0m
  Help with a program written in perl Rodman42866 1 417 03-09-2012 06:16 AM
Last Post: AceInfinity
  HTML perl script AceInfinity 5 654 12-04-2011 02:35 AM
Last Post: Closed Account
  Perl ARGV Tutorial AceInfinity 0 1,343 08-22-2011 05:30 PM
Last Post: AceInfinity

Forum Jump:


User(s) browsing this thread: 1 Guest(s)