Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board IRC Bot Download Source Code
Author Details Code Information
SpamBurger ( Kurtis Dinelle )

Pinned 1 Codes
Posted 1 Coding Articles

Send A Message
View Coders Profile
Language Perl
Expires Never
Length 1,495 Characters (37 Lines)
Password no password
  1. use Net::IRC;
  2. use Net::MySQL;
  3. $server="someserver";
  4. $chan="#somechan";
  5. $tblname="tablename";
  6. $botname="botname";
  7. $mysql=Net::MySQL->new(hostname=>"localhost", database=>"database", user=>"user", password=>"password");
  8. $irc=new Net::IRC;
  9. $conn=$irc->newconn(Nick=>$botname, Server=>$server, Port=>6667, Ircname=>$botname, Username=>$botname);
  10. $conn->add_global_handler('376',\&on_connect);
  11. $conn->add_handler('public',\&on_public);
  12. $irc->start();
  13. sub on_connect{
  14.            $self=$_[0];
  15.            $self->join($chan);
  16. }
  17. sub on_public{
  18.            ($self,$event)=@_;
  19.            $text=$event->(args)[0];
  20.            $nick=$event->nick;
  21.            if($text=~/((what)|(wut)|(wat)|(whut)|(wtf))(( is)|('s)|(s)|( are)) ([^\?]+)\??/i){
  22.                      $what=$12;
  23.                      $mysql->query("SELECT * FROM $tblname WHERE what LIKE '%$what%'");
  24.                      $set=$mysql->set_record_iterator();
  25.                      while($record=$set->each()){
  26.                                $who=$record->[0];
  27.                                $isthis=$record->[2];
  28.                                print "$who said $what is $isthis. ";
  29.                      }
  30.                      $self->privmsg($chan,$what);
  31.            }elsif($text=~/ is /i){
  32.                      @whatsthis=split(/ is /i,$text);
  33.                      $what=$whatsthis[0];
  34.                      $isthis=$whatsthis[1];
  35.                      $mysql->query("INSERT INTO $tblname VALUES('$nick','$what','$ishis')");
  36.            }
  37. }
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
 
VBAssassin     Posted 199 Days Ago
 
 
37 lines... not bad
 
Cinjection     Posted 216 Days Ago
 
 
Sexy little thang you got there.
Page 1 of 1
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved