|
|
 |
 |
 |
|
|
| Author Details |
Code Information |
|
|
|
Language
|
Perl
|
|
Expires
|
Never
|
|
Length
|
1,495 Characters (37 Lines)
|
|
Password
|
no password
|
|
|
use Net::IRC; use Net::MySQL; $server="someserver"; $chan="#somechan"; $tblname="tablename"; $botname="botname"; $mysql=Net::MySQL->new(hostname=>"localhost", database=>"database", user=>"user",
password=>"password"); $irc=new Net::IRC; $conn=$irc->newconn(Nick=>$botname, Server=>$server, Port=>6667, Ircname=>$botname, Username=>$botname); $conn->add_global_handler('376',\&on_connect); $conn->add_handler('public',\&on_public); $irc->start(); sub on_connect{ $self=$_[0]; $self->join($chan); } sub on_public{ ($self,$event)=@_; $text=$event->(args)[0]; $nick=$event->nick; if($text=~/((what)|(wut)|(wat)|(whut)|(wtf))(( is)|('s)|(s)|( are)) ([^\?]+)\??/i){ $what=$12; $mysql->query("SELECT * FROM $tblname WHERE what LIKE '%$what%'"); $set=$mysql->set_record_iterator(); while($record=$set->each()){ $who=$record->[0]; $isthis=$record->[2]; print "$who said $what is $isthis. "; } $self->privmsg($chan,$what); }elsif($text=~/ is /i){ @whatsthis=split(/ is /i,$text); $what=$whatsthis[0]; $isthis=$whatsthis[1]; $mysql->query("INSERT INTO $tblname VALUES('$nick','$what','$ishis')"); } } |
|
| Please login to post comments. |
|
|
Sexy little thang you got there.
|
|
|
|
|
| |
 |
 |
| |
::
::
::
::
|
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved
|
|
|
|
|