Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IRC Bot problems...

Status
Not open for further replies.

Raenius

Programmer
Oct 14, 2003
77
0
0
NL
Hi all,

I've just started writing the most basic bot ever, namely the hello_bot :) Basically it is supposed to log into a channel and greet it...

This is the source code I have:

Code:
use Net::IRC;

$irc = new Net::IRC;

$conn = $irc->newconn(
      Nick    => 'DCPTestBot',
      Server  => 'ede.nl.eu.undernet.org',
      Port    => '6667', 
      Ircname => 'Testing');

$irc->start;

# Add our handlers here

$conn->add_handler('376', &on_connect);

   
sub on_connect {
   my $self = shift;

   print "Joining #testbot";
   $self->join("#testbot");
   $self->privmsg("#testbot", "Hi there.");
 }

As you can see pretty straightforward. The problem is I never see the bot connecting to the channel I am in. (just created one on a server....

I am creating this using Activestate Perl 5.8 and ofcourse using the perl module.

The error I am getting is: No active connections left, exiting...

Does anyone have an idea of what might be going on?

Thanks!

- Raenius

"Free will...is an illusion"
 
I'm not positive, but I think the Net::IRC module is deprecated, and you should probably use POE::Component::IRC instead.
Also, check out IRC::Bot and Bot::BasicBot, which both use POE::Component::IRC. Looking at those modules should give you a pretty good idea on how to create your own bot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top