in reply to Re: Net::IRC Auto-OP
in thread Net::IRC Auto-OP

I've checked for private messages from Chanserv. There aren't any.

I've checked the value of $conn->{channel} and $nick using print statements. They are set to the correct values. Here is the on_join sub:
sub on_join { my ($conn, $event) = @_; my $nick = $event->{nick}; if ($nick eq ("xxx" || "yyy")) { $conn->privmsg("Chanserv", "OP $conn->{channel} $nick"); print "Auto-Op $nick\n"; $conn->privmsg($nick, "You have been Auto-Oped by $mynick"); $conn->me($conn->{channel}, "Auto-Ops $nick"); } $conn->privmsg($conn->{channel}, "Welcome, $nick!") unless ($ni +ck eq $mynick); print "[$mynick] Welcome, $nick!\n" unless ($nick eq $mynick); }
$mynick is equal to the bot's nick.
xxx and yyy are the nicks of the users to be OPed.

Replies are listed 'Best First'.
Re^3: Net::IRC Auto-OP
by friedo (Prior) on Jun 03, 2007 at 21:46 UTC
    This:
    if ($nick eq ("xxx" || "yyy"))
    doesn't make sense. You're checking $nick for string-equality with the logical-ORed value of "xxx" and "yyy" which is just going to be "xxx". What you probably meant was
    if ( $nick eq "xxx" or $nick eq "yyy" )
    If you have a bigger list of nicks you can use a hash, which is a lot easier than constructing a gigantic conditional.
    my %ops = ( xxx => 1, yyy => 1, zzz => 1 ); if ( $ops{$nick} == 1 ) { ... }
      Even fixing the or statement (I'll swith to a hash when I get a bigger list), it still won't op the users.
Re^3: Net::IRC Auto-OP
by kunwon1 (Sexton) on Jun 03, 2007 at 22:13 UTC
    Does this
    print "Auto-Op $nick\n";
    print statement print? If not, you're not getting into the if block.

    And again, are you using strict and warnings pragmas?
      It prints. All the other commands in the if statement are also executed.
        Hmm, interesting. Well, if I were you I'd change 'Chanserv' in your privmsg to a nick under your control, and see if you receive the message. If so, then it's a chanserv problem. If not, you'll need a greater monk than I to further assist you :)