Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- ##############
- # LoU-Bot #
- # by Zoadian #
- ##############
- #Irc Settings
- $IrcServer = 'irc.server.com';
- $IrcSrcPort = '1222';
- $IrcDstPort = '666';
- $IrcNick = '_BOT_';
- $IrcUser = 'username hostname servername :realname'; #<username> <hostname> <servername> :<realname>
- $IrcPass = 'password';
- @IrcChannel = ('##akn');
- $IrcAutoRejoin = 'true';#
- #Command Settings
- $CmdPrefix = '#';
- #Function Settings
- #Help
- $help = 'true';
- #Trade - want to sell/want to buy
- $wts = 'true';
- $wtb = 'true';
- use IO::Socket;
- use Switch;
- use Digest::MD5 qw(md5_hex);
- #create connection
- $con = IO::Socket::INET->new(PeerAddr=>$IrcServer,
- LocalPort => $IrcSrcPort,
- PeerPort=>$IrcDstPort,
- Proto=>'tcp',
- Timeout=>'30') || print "Error: Connection";
- #set user
- print $con "PASS $IrcPass\n";
- print $con "USER $IrcUser\n";
- print $con "NICK $IrcNick\n";
- #join channels
- foreach my $channel (@IrcChannel){
- print $con "JOIN $channel\n";
- }
- #get msgs
- while(my $answer = <$con>)
- {
- print "$answer\n";#output all
- #split msg
- if($answer =~ m/^:(.*?)!(.*?)@(.*?) PRIVMSG (.*?) :(.*?)$/)
- {
- #just set up some variables to store information
- $recvNick = $1;
- $recvIdent = $2;
- $recvHost = $3;
- $recvChannel = $4;
- $recvText = $5;
- @strpart = split(" ",$recvText);
- $strpart[0] = "";
- $msg = join ' ', @strpart;
- }
- if ($answer=~ m/^PING (.*?)$/gi) {print $con "PONG $1\n";} ;
- #############
- # Functions #
- #############
- #Print Help
- if( $help == 'true' && $answer =~ m/($CmdPrefix)help/ )
- {
- #Help
- if($help == 'true'){print $con "PRIVMSG $recvNick :" . $CmdPrefix . "help\n";}
- #trade
- if($wts == 'true'){print $con "PRIVMSG $recvNick :" . $CmdPrefix . "wts wood 50k\n";}
- if($wtb == 'true'){print $con "PRIVMSG $recvNick :" . $CmdPrefix . "wtb stone 50k\n";}
- }
- #Want to sell
- if( $wts == 'true' && $answer =~ m/($CmdPrefix)wts/ ){
- #do stuff here
- }
- #Want to buy
- if( $wts == 'true' && $answer =~ m/($CmdPrefix)wts/ ){
- #du stuff here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement