Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 16.00 KB | None | 0 0
  1. #!/usr/bin/perl
  2. print "POE IRC Bot. Skeleton by Caaz.\n";
  3. print "You can add an optional NICK.\n";
  4. print "SERVER \(Optional PORT, and NICK\)\n";
  5. chomp($Connect = <STDIN>);
  6.  
  7. use lib '/Users/Caaz/lib';
  8. use POE::Component::IRC;
  9. use POE;
  10. use LWP::Simple;
  11. use LWP::UserAgent;
  12. use Digest::MD5 qw(md5 md5_hex md5_base64);
  13. use HTML::Strip;
  14.  
  15. BOTVARS: {
  16.     $BotNick = "MajinBot";      # Nick
  17.     $BotUser = ".";     # Username "indent"
  18.     $BotName = "a Perl bot. Version 3"; # Real Name
  19.     $BotPass = "PASSWORD";      # Nickserv Password
  20.     $BotOwner = "MajinMew";     # Owner of the Bot
  21.     $BotPath = "C:\\users\\Steven\\desktop\\majinbot\\";        # Path to any files.
  22. }
  23. FILES: {
  24.     open DATA, "<".$BotPath."DBUsers.txt";
  25.     @DB = <DATA>;
  26.     chomp($DBUsers = $DB[0]);
  27.     close DATA;
  28. }
  29. open DATA, "<".$BotPath.(split / /, $Connect)[0]."-AutoJoin.txt";
  30. @Channels=<DATA>;
  31. close DATA;chomp(@Channels);
  32. $BotChannels = $Channels[0];
  33. $Connect = $Connect." ".$BotNick." ";
  34. $BotNick = (split / /, $Connect)[2];
  35. my $hs = HTML::Strip->new();
  36. my ($irc) = POE::Component::IRC->spawn();
  37. POE::Session->create(inline_states => {
  38.     _start     => sub {
  39.         $irc->yield(register => "all");
  40.         $irc->yield( connect => {
  41.             Nick     => (split / /, $Connect)[2],
  42.             Username => $BotUser,
  43.             Ircname  => $BotName,
  44.             Server   => (split / /, $Connect)[0],
  45.             Port     => (split / /, $Connect)[1],
  46.         });
  47.     },
  48.     irc_001 => sub {
  49.         $irc->yield(mode => $BotNick." +B");
  50.         $irc->yield(privmsg => "Nickserv" => "id ".$BotPass);
  51.         my $alarm_id = $irc->delay( [ join => $BotChannels ], 2 );
  52.     },
  53.     irc_error => sub {
  54.         my ($kernel, $IRCWhat) = @_[KERNEL, ARG0];
  55.         print $IRCWhat."\n";
  56.     },
  57.     irc_ctcp_action => sub {
  58.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  59.         $IRCWhere = $where->[0];
  60.         print GetTime()."$IRCWhere >    * ".(split /!/, $IRCWho)[0]." $IRCWhat\n";
  61.         Bot("ACTION",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  62.     },
  63.     irc_join => sub {
  64.         my ($kernel, $IRCWho, $IRCWhere) = @_[KERNEL, ARG0, ARG1];
  65.         print GetTime()."Join       * ".(split /!/, $IRCWho)[0]." joins $IRCWhere\n";
  66.         Bot("JOIN",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere);
  67.     },
  68.     irc_invite => sub {
  69.         my ($kernel, $IRCWho, $IRCWhere) = @_[KERNEL, ARG0, ARG1];
  70.         print GetTime()."Invi       * ".(split /!/, $IRCWho)[0]." invites you to $IRCWhere\n";
  71.         Bot("INVITE", (split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere);
  72.     },
  73.     irc_kick => sub {
  74.         my ($kernel, $IRCWho, $IRCWhere, $IRCWhoElse, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2, ARG3];
  75.         print GetTime()."Kick       * ".(split /!/, $IRCWho)[0]." kicks $IRCWhoElse out of $IRCWhere ($IRCWhat)\n";
  76.         Bot("KICK",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhoElse,$IRCWhat);
  77.     },
  78.     irc_msg => sub {
  79.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  80.         $IRCWhere = $where->[0];
  81.         print GetTime()."Priv\a>        <".(split /!/, $IRCWho)[0].">   $IRCWhat\n";
  82.         Bot("PRIVMSG",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  83.     },
  84.     irc_nick => sub {
  85.         my ($kernel, $IRCWho, $IRCWhoElse) = @_[KERNEL, ARG0, ARG1];
  86.         print GetTime()."Nick       * ".(split /!/, $IRCWho)[0]." changes nick to $IRCWhoElse\n";
  87.         Bot("NICK", (split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhoElse);
  88.     },
  89.     irc_notice => sub {
  90.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  91.         $IRCWhere = $where->[0];
  92.         print GetTime()."Noti       <".(split /!/, $IRCWho)[0].">   $IRCWhat\n" if((split /!/, $IRCWho)[0] !~ /WolfBot/i);
  93.         Bot("NOTICE",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  94.     },
  95.     irc_part => sub {
  96.         my ($kernel, $IRCWho, $IRCWhere, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  97.         print GetTime()."Part       * ".(split /!/, $IRCWho)[0]." left channel $IRCWhere \(".$IRCWhat."\)\n";
  98.         Bot("PART",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  99.     },
  100.     irc_public => sub {
  101.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  102.         $IRCWhere = $where->[0];
  103.         print GetTime()."$IRCWhere >    <".(split /!/, $IRCWho)[0].">   $IRCWhat\n";
  104.         Bot("CHANMSG",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  105.     },
  106.     irc_disconnected => sub { print "Disconnected.\n"; exit 1; }, # Ends on disconnect.
  107. },);
  108. sub Bot {
  109.     $Event = $_[0];
  110.     if($Event =~ /CHANMSG/) { $Com = "privmsg ".$_[3]." "; $UserMsg = $_[4]; $Where = $_[3]; }
  111.     elsif($Event =~ /NOTICE/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[4]; $Where = $_[1]; }
  112.     elsif($Event =~ /PRIVMSG/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[4]; $Where = $_[1]; }
  113.     elsif($Event =~ /INVITE/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[3]; $Where = $_[1]; if ($UserMsg !~ /Spp/i) { $irc->yield(join => $UserMsg); }} # Joins on invite, if it's not spp. heh.
  114.     elsif($Event =~ /JOIN/) { $Com = "notice ".$_[3]." "; $UserMsg = $_[3]; $Where = $_[1]; }
  115.     elsif($Event =~ /NICK/) { if($_[1] =~ /^$BotOwner$/i) { print "Owner changing...\n"; $BotOwner = Regexit($_[3]) } }
  116.     $UserNick = Regexit($_[1]);
  117.     $UserHost = $_[2];
  118.     $UserMsg = POE::Component::IRC::Common::strip_formatting(POE::Component::IRC::Common::strip_color($UserMsg));
  119.     $CurSec = SpamProtect();
  120.     &CREATEUser($UserNick);
  121.     if($DBUsers =~ /(.*)<$UserNick :(.*?)\[Access (.*?)\](.*?)>(.*)/i) {
  122.         $Access = $3;
  123.         if($Access <= 0) {
  124.             return 0;
  125.         }
  126.     }
  127.     if(($Where =~ /wwolf/i) || ($UserNick =~ /Wolfbot/i)) {
  128.         if($Event =~ /(CHANMSG|NOTICE|PRIVMSG)/) {
  129.             if(($UserMsg =~ /^($BotNick|Bots), Join/i) && ($WW{"Will Join"} !~ /No/i)) {
  130.                 $irc->yield(privmsg => "#WWolf" => "!Join");
  131.                 $WW{"Will Join"} = "No";
  132.                 $WW{"MyType"} = "Villager";
  133.             }
  134.             elsif(($UserMsg =~ /^$BotNick, Leave/i) && ($WW{"Will Join"} =~ /No/i)) {
  135.                 $irc->yield(part => "#WWolf" => "Invite me, and I will continue playing.");
  136.                 $WW{"Will Join"} = "Yes";
  137.             }
  138.             elsif($UserMsg =~ /^$BotNick won,/i) {
  139.                 my $alarm_id = $irc->delay( [ privmsg => "#wwolf" => "Woohoo! I won. :D" ], 1 );
  140.                 while ( ($key, $value) = each %WW ) {
  141.                     $WW{$key} = "";
  142.                 }
  143.             }
  144.             elsif($UserMsg =~ /^$BotNick lost,/i) {
  145.                 my $alarm_id = $irc->delay( [ privmsg => "#wwolf" => ";~; I didn't think I'd lose..." ], 1 );
  146.                 while ( ($key, $value) = each %WW ) {
  147.                     $WW{$key} = "";
  148.                 }
  149.             }
  150.             elsif($UserMsg =~ /^The game is over\.$/i) {
  151.                 while ( ($key, $value) = each %WW ) {
  152.                     $WW{$key} = "";
  153.                 }
  154.             }
  155.             elsif($UserMsg =~ /^($BotNick|Bots), what are you/i) {
  156.                 if($WW{"MyType"} =~ /Wolf|Village Idiot/) {
  157.                     $irc->yield(privmsg => "#WWolf" => "I am a Villager.");
  158.                 }
  159.                 else {
  160.                     $irc->yield(privmsg => "#WWolf" => "I am a ".$WW{"MyType"}.".");
  161.                 }
  162.             }
  163.             elsif($UserMsg =~ /(.*?) (has joined|has started)/i) {
  164.                 if($1 =~ /$BotNick/) { return 0; }
  165.                 $WW{"Players"} = $WW{"Players"}.$1." ";
  166.                 @WWPlayers = split / /, $WW{"Players"};
  167.                 print "Updating players...\n".@WWPlayers."\n";
  168.             }
  169.             elsif($UserMsg =~ /^(.*) (has left the game|struggles vainly|was)/i) {
  170.                 $WW{"Players"} =~ s/$1 //igs;
  171.                 @WWPlayers = split / /, $WW{"Players"};
  172.                 print "Updating players...\n".@WWPlayers."\n";
  173.             }
  174.             elsif($UserMsg =~ /seconds to send your votes/i) {
  175.                 if($WW{"Vote"} =~ /^$/) {
  176.                     my $alarm_id = $irc->delay( [ privmsg => "WolfBot" => "vote ".$WWPlayers[int(rand(@WWPlayers))] ], 5 );
  177.                     print $WWPlayers[int(rand(@WWPlayers))];
  178.                 }
  179.                 else {
  180.                     my $alarm_id = $irc->delay( [ privmsg => "WolfBot" => "vote ".$WW{"Vote"} ], 5 );
  181.                 }
  182.                 $WW{"Vote"} = "";
  183.                 if($WW{"MyType"} =~ /Village Idiot/i) {
  184.                     $WW{"Vote"} = $BotNick;
  185.                 }
  186.             }
  187.             if(($UserNick =~ /WolfBot/i) && ($Event =~ /(NOTICE|PRIVMSG|CHANMSG)/)) {
  188.                 if($UserMsg =~ /You are a wolf!/i) {
  189.                     $WW{"MyType"} = "Wolf";
  190.                     print "Wolf!";
  191.                 }
  192.                 elsif($UserMsg =~ /You are the finder!/i) {
  193.                     $WW{"MyType"} = "Finder";
  194.                 }
  195.                 elsif($UserMsg =~ /You are the seer!/i) {
  196.                     $WW{"MyType"} = "Seer";
  197.                 }
  198.                 elsif($UserMsg =~ /You are the doppleganger!/i) {
  199.                     $WW{"MyType"} = "Doppleganger";
  200.                 }
  201.                 elsif($UserMsg =~ /You are the angel!/i) {
  202.                     $WW{"MyType"} = "Angel";
  203.                 }
  204.                 elsif($UserMsg =~ /You are the Village Idiot!/i) {
  205.                     $WW{"MyType"} = "Village Idiot";
  206.                     my $alarm_id = $irc->delay( [ privmsg => "#WWolf" => $WWPlayers[int(rand(@WWPlayers))]." is Wolf." ], 50 );
  207.                     $WW{"Vote"} = $BotNick;
  208.                 }
  209.                 elsif($UserMsg =~ /into (a|an) (.*?)!/i) {
  210.                     $tring = $2;
  211.                     if($tring =~ /werewolf/i) { $WW{"MyType"} = "Wolf"; }
  212.                     else {
  213.                         $WW{"MyType"} = $tring;
  214.                     }
  215.                 }
  216.                 elsif($UserMsg =~ /You have 45/i) {
  217.                     if($WW{"MyType"} =~ /Wolf/i) {
  218.                         $irc->yield(privmsg => "wolfbot" => "kill ".$WWPlayers[int(rand(@WWPlayers))]);
  219.                     }
  220.                     elsif($WW{"MyType"} =~ /Seer/i) {
  221.                         foreach (@WWPlayers) {
  222.                             if($WW{"Targeted"} !~ /Regexit($_)/i){
  223.                                 $WW{"Targeted"} = $WW{"Targeted"}.Regexit($_);
  224.                                 $WW{"Target"} = $_;
  225.                                 last;
  226.                             }
  227.                         }
  228.                         $irc->yield(privmsg => "wolfbot" => "see ".$WW{"Target"});
  229.                     }
  230.                     elsif($WW{"MyType"} =~ /Finder/i) {
  231.                         foreach (@WWPlayers) {
  232.                             if($WW{"Targeted"} !~ /Regexit($_)/i){
  233.                                 $WW{"Targeted"} = $WW{"Targeted"}.Regexit($_);
  234.                                 $WW{"Target"} = $_;
  235.                                 last;
  236.                             }
  237.                         }
  238.                         $irc->yield(privmsg => "wolfbot" => "find ".$WW{"Target"});
  239.                     }
  240.                     if($WW{"MyType"} =~ /Doppleganger/i) {
  241.                         $WW{"Target"} = $WWPlayers[int(rand(@WWPlayers))];
  242.                         $irc->yield(privmsg => "wolfbot" => "dopple ".$WW{"Target"});
  243.                     }
  244.                     if($WW{"MyType"} =~ /Angel/i) {
  245.                         $WW{"Target"} = $WWPlayers[int(rand(@WWPlayers))];
  246.                         $irc->yield(privmsg => "wolfbot" => "shield ".$WW{"Target"});
  247.                     }
  248.                 }
  249.                 elsif($UserMsg =~ /(.*?) is (a|an) (.*?)!/i) {
  250.                     $tring = $1;
  251.                     $tringt = $3;
  252.                     if($tringt =~ /(Wolf|Village Idiot)/i) {
  253.                         my $alarm_id = $irc->delay( [ privmsg => "#WWolf" => $tring." is ".$1."." ], 5 );
  254.                         $WW{"Vote"} = $tring if($tringt !~ /Village Idiot/);
  255.                     }
  256.                     elsif($tringt =~ /Angel/i) {
  257.                         my $alarm_id = $irc->delay( [ privmsg => $tring => "I'm seer, and you're angel, right? Protect me, I'll keep looking for the wolf." ], 2 );
  258.                     }
  259.                     elsif($tringt =~ /Doppleganger/i) {
  260.                         my $alarm_id = $irc->delay( [ privmsg => $tring => "Dopple me for seer!" ], 2 );
  261.                     }
  262.                 }
  263.                 elsif($UserMsg =~ /(.*?) targetted (.*?)!/i) {
  264.                     $tring = $1;
  265.                     $tringt = $3;
  266.                     my $alarm_id = $irc->delay( [ privmsg => "#WWolf" => $tring." targetted ".$tringt."." ], 5 );
  267.                     $WW{"Vote"} = $tring;
  268.                 }
  269.                 elsif($UserMsg =~ /The (wolves|other wolves) are: (.*)/i) {
  270.                     @WWolfs = split /, /, $1;
  271.                     print "Updating players...\n";
  272.                     foreach (@WWolfs) {
  273.                         $WW{"Players"} =~ s/$_ //gs;
  274.                         @WWPlayers = split / /, $WW{"Players"};
  275.                         print "Updating players...\n".@WWPlayers."\n";
  276.                     }
  277.                 }
  278.             }
  279.         }
  280.     }
  281.     if($Event =~ /(CHANMSG|NOTICE|PRIVMSG)/) {
  282.         ($tring = $UserMsg) =~ s/-|\[|\]|\{|\}|\(|\)|\*|\.|\?|\!//igs;
  283.         $Prefix = "\`";
  284.         if($UserMsg !~ /^$Prefix/i) { return 0; }
  285.         $UserMsg =~ s/^$Prefix//gs;
  286.         #&Op($UserNick,$UserHost,$tring,$Where);
  287.         #####################
  288.         #   Owner commands  #
  289.         #####################
  290.         if(($UserMsg =~ /^End$/i) && ($UserNick =~ /^$BotOwner$/i)) {
  291.             $irc->yield(quit => POE::Component::IRC::Common::MAGENTA."~ Goodbye ~");
  292.         }
  293.         elsif($_[4] =~ /^Do (.*?) (.*?) (.*)/i) {
  294.             @Temp = ($1,$2,$3);
  295.             if($UserNick =~ /^$BotOwner$/i) {
  296.                 $irc->yield($Temp[0] => $Temp[1] => $Temp[2]);
  297.             }
  298.         }
  299.         elsif($UserMsg =~ /^Nick (.*)/i) {
  300.             $tring = $1;
  301.             if($UserNick =~ /^$BotOwner$/i) {
  302.                 $BotNick = $tring;
  303.                 $irc->yield(nick => $tring);
  304.             }
  305.         }
  306.         elsif($UserMsg =~ /^Amsg (.*)/i) {
  307.             $tring = $1;
  308.             if($UserNick =~ /^$BotOwner$/i) {
  309.                 $irc->yield(privmsg => $BotChannels => $tring);
  310.             }
  311.         }
  312.         #####################
  313.         #Important Commands #
  314.         #####################
  315.         elsif($UserMsg =~ /^(Help|Commands)$/i) {
  316.             Command($Com."Totally updated by Caaz");
  317.         }
  318.         elsif($UserMsg =~ /^Reload$/i) {
  319.             open DATA, "<".$BotPath."DBUsers.txt";
  320.             @DB = <DATA>;
  321.             chomp($DBUsers = $DB[0]);
  322.             close DATA;
  323.         }
  324.         elsif($UserMsg =~ /^AJ$/i) {
  325.             open DATA, "<".$BotPath.(split / /, $Connect)[0].(split / /, $Connect)[1]."-AutoJoin.txt";
  326.             @Channels=<DATA>;
  327.             close DATA;
  328.             if($Channels[0] !~ /$Where,/i) {
  329.                 open DATA, ">>".$BotPath.(split / /, $Connect)[0].(split / /, $Connect)[1]."-AutoJoin.txt"; print DATA "$Where,"; close DATA;
  330.                 Command($Com."Channel added to AutoJoin.");
  331.             }
  332.             else {
  333.                 Command($Com."Channel already in AutoJoin.");
  334.             }
  335.         }
  336.         elsif($UserMsg =~ /^Alert$/i) {
  337.             print "\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\n";
  338.         }
  339.         #####################
  340.         #  Random Commands  #
  341.         #####################
  342.         elsif($UserMsg =~ /^Catch$/i) {
  343.             if($CurSec >= $Lag{$Where."-Poke"}) {
  344.                 $PokeD--;
  345.                 if($UserNick !~ /$PokeE/i) { $PokeD = 0; }
  346.                 $PokeE = $UserNick;
  347.                 open DATA, "<".$Path."\\Counters\\".$UserNick." - poke.txt";
  348.                 @Count=<DATA>;
  349.                 close DATA;
  350.                 chomp($PokeB = $Count[0]);
  351.                 open DATA, "<".$Path."pokelist.txt";
  352.                 @Poke=<DATA>;
  353.                 $RandNum = int(rand($.));
  354.                 close DATA; chomp(@Poke);
  355.                 $PokeA = "got away..";
  356.                 if((int(rand(100)) - ($PokeD * 3)) > 50) {
  357.                     $PokeA = "was caught! $UserNick now has ".($PokeB + 1)." Pokemon";
  358.                     $PokeB++;
  359.                     open DATA, ">".$Path."\\Counters\\".$UserNick." - poke.txt";
  360.                     print DATA $PokeB;
  361.                     close DATA;
  362.                     $PokeType = int(rand(120));
  363.                     if($PokeType > 90) { $PokeC = "Shiny "; }
  364.                     if($PokeType > 105) { $PokeC = "Shadow "; }
  365.                     if($PokeType > 100) { $PokeC = "Hentai "; }
  366.                     $irc->yield($Command => $Where => "A wild ".$PokeC.$Poke[$RandNum]." Appeared! $UserNick threw a Pokeball...".$Poke[$RandNum]." ".$PokeA);
  367.                     $Lag{$Where."-Poke"} = $CurSec + 2.5;
  368.                     $PokeC = "";
  369.                 }
  370.             }
  371.         }
  372.         elsif($UserMsg =~ /^Add (.*)/i) {
  373.             open DATA, ">>".$Path."pokelist.txt";
  374.             print DATA $1.$2."\n";
  375.             close DATA;
  376.             $irc->yield($Command => $Where => "Added $1$2 to Pokemon list,");
  377.         }
  378.         elsif($UserMsg =~ /^Catch off/i) {
  379.             $irc->yield($Command => $Where => "Catch is now off in this channel. Ask an admin of this bot for it to be turned back on.");
  380.             $Lag{ $Where."-Poke" } = $CurSec + 90000000001;
  381.         }
  382.         elsif(($UserMsg =~ /^Catch on/i) && ($Access >= 10)) {
  383.             $irc->yield($Command => $Where => "Catch is now on in this channel. ");
  384.             $Lag{$Where."-Poke"} = $CurSec;
  385.         }
  386.         #####################
  387.         #        END        #
  388.         #####################
  389.     }
  390. }
  391. sub Regexit {
  392.     ($Reg = $_[0]) =~ s/\\/\\\\/gs;
  393.     $Reg =~ s/(\?|\(|\)|\||\[|\|\{|\}|\.)/\\$1/gs;
  394.     $Reg =~ s/\*/\(\.\*\)/gs;
  395.     return $Reg;
  396. }
  397. sub CREATEUser {
  398.     if($DBUsers !~ /(.*)<$_[0] :(.*?)>(.*)/i) {
  399.         open DATA, ">>".$BotPath."DBUsers.txt";
  400.         print DATA "<".$_[0]." : \\\[Access 1\\\] >";
  401.         close DATA;
  402.         open DATA, "<".$BotPath."DBUsers.txt";
  403.         @DB = <DATA>;
  404.         chomp($DBUsers = $DB[0]);
  405.         close DATA;
  406.     }
  407. }
  408. sub SpamProtect {
  409.     my($Sec, $Min, $Hour, $Day, $mon, $year, $WDay, $YDay) = localtime;
  410.     return (((($YDay * 24) * 60) * 60) + (($Hour * 60) * 60) + ($Min * 60) + $Sec);
  411. }
  412. sub Command {
  413.     $PrivmsgA = $_[0];
  414.     @PrivmsgB = split / /, $PrivmsgA;
  415.     $ComA = shift(@PrivmsgB);
  416.     $ComB = shift(@PrivmsgB);
  417.     if($BotNick =~ /Luka/i) { $BotFont = "〜"; $irc->yield($ComA => $ComB => POE::Component::IRC::Common::MAGENTA.(join " ", @PrivmsgB)." 〜"); }
  418.     if($BotNick =~ /(Rin|Ren)/i) { $BotFont = "〜"; $irc->yield($ComA => $ComB => POE::Component::IRC::Common::ORANGE.(join " ", @PrivmsgB)." ☯"); }
  419.     elsif($BotNick =~ /Pichu/i) { $BotFont = "⚡"; $irc->yield($ComA => $ComB => POE::Component::IRC::Common::ORANGE.(join " ", @PrivmsgB)." ⚡"); }
  420.     elsif($BotNick =~ /Akul/i) { $irc->yield($ComA => $ComB => POE::Component::IRC::Common::MAGENTA.(reverse(join " ", @PrivmsgB))." 〜"); }
  421. }
  422. sub GetTime { # This is just for timestamps, just leave it.
  423.     my($Sec, $Min, $Hour, $Day, $Mon, $Year, $WDay, $YDay) = localtime;
  424.     my $APM = "AM";
  425.     if($Hour > 12) { $Hour -= 12; $APM = "PM"; }
  426.     if($Hour < 10) { $Hour = "0".$Hour; }
  427.     if($Min < 10) { $Min = "0".$Min; }
  428.     if($Sec < 10) { $Sec = "0".$Sec; }
  429.     return "[ $Hour:$Min:$Sec $APM ]    ";
  430. }
  431. # Caaz was here. Again.
  432. $poe_kernel->run();
  433. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement